问题
将git从库从windows拷贝到linux/macOS时,很多变动,diff时会显示^M
问题原因
因为windows用的CRLF当作换行符,linux用的LF,所以有区别
解决方法
git diff
的时候忽略换行符的差异
git config --global core.autocrlf input
也可以修改.gitattributes
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary