GIT 提交^M 文件所有行都被修改

$ git config --global core.autocrlf true

Of course, this is said to convert crlf to lf, while you want to convert cr to lf. I hope this still works …

And then convert your files:

# Remove everything from the index
$ git rm --cached -r .

# Re-add all the deleted files to the index
# You should get lots of messages like: "warning: CRLF will be replaced by LF in <file>."
$ git diff --cached --name-only -z | xargs -0 git add

# Commit
$ git commit -m "Fix CRLF"

from:

https://stackoverflow.com/questions/1889559/git-diff-to-ignore-m

踩坑之路多回顾,不要在一个坑掉两次! THINK TWICE,CODE ONCE!
原文地址:https://www.cnblogs.com/zhishuai/p/15716044.html