git 提交出现LF和CRLF换行符不一致导致的Git显示修改问题分析及解决

root@DESKTOP-Q3N0JNG:/mnt/d/wwwroot/red-tomato-business/serve# git add .
warning: CRLF will be replaced by LF in serve/app/jobs/apis/sys_job.go.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in serve/app/jobs/examples.go.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in serve/app/jobs/models/sys_job.go.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in serve/app/jobs/service/dto/sys_job.go.

首先可以先依据大佬的写法

解决方式: 

可以查看git配置

 git config -l

情况一:

Git 可以在你提交时自动地把回车(CR)和换行(LF)转换成换行(LF),而在检出代码时把换行(LF)转换成回车(CR)和换行(LF)。 你可以用git config --global core.autocrlf true 来打开此项功能。 如果是在 Windows 系统上,把它设置成 true,这样在检出代码时,换行会被转换成回车和换行:

#提交时转换为LF,检出时转换为CRLF
$ git config 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值