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

本秂侑毒 提交于 2019-12-09 11:20:46

问题


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 autocrlf = false in .gitconfig, because I want to keep lf rather than auto or crlf.


回答1:


Try to use autocrlf option in git config.

git config core.autocrlf true



回答2:


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



来源:https://stackoverflow.com/questions/6081455/when-i-saved-in-windows-7-git-diff-shows-all-the-lines-with-m

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!