我决定通过一个.gitattributes
文件以正确的方式设置我的行结尾,详见例如此处 - 所以我将core.autocrlf设置为false,并创建并提交了一个.gitattributes文件:
*.java text eol=native
*.jsp text eol=native
*.css text eol=native
*.html text eol=native
*.js text eol=native
*.xml text eol=native
*.sql text eol=native
*.MF text eol=native
# git files
*.gitignore text eol=native
*.gitattributes text eol=native
#eclipse files
*.classpath text eol=native
*.project text eol=native
*.prefs text eol=native
*.properties text eol=native
我接着执行了
git rm --cached -r .
,然后执行了git reset --hard
(也尝试了git checkout HEAD
),如这里所建议的。现在所有文件都有LF换行符。难道不应该是CRLF吗?我错过了什么?我使用的是Windows 7,git version 1.8.0.msysgit.0
。谢谢。
rm .git/index
然后git reset
,但是没有任何变化 - 我已经提交了 gitattributes - 不管怎样奇怪的是checkout
应该检出 Windows 行结尾 - 我错过了什么吗?我编写的 gitattributes 似乎没问题,对吧? - Mr_and_Mrs_D