开发者

When I saved in Windows 7, git diff shows all the lines with ^M

开发者 https://www.devze.com 2023-03-07 17:08 出处:网络
I used Ubuntu to upload a repository to github. I downloaded to windows 7 and using msysgit. When I saved some files in Windows without any changes.

I used Ubuntu to upload a repository to github.

I downloaded to windows 7 and using msysgit. When I saved some files in Windows without any changes.

When I do git status, they are listed as modified.

When I do git diff, all the line has ^M at the end.

What is this ^M and how can I ignore this?

Thanks in advance.

UPDATE

I have auto开发者_如何学Ccrlf = false in .gitconfig, because I want to keep lf rather than auto or crlf.


Try to use autocrlf option in git config.

git config core.autocrlf true


The ^M symbol is the Windows end-of-line encoding.

The following should fix it:

git config --global core.autocrlf true

Similar question is here

0

精彩评论

暂无评论...
验证码 换一张
取 消