【发布时间】:2012-11-23 15:31:31
【问题描述】:
我决定通过.gitattributes 文件将行尾设置为正确的方式,例如here - 所以我将 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),正如here所建议的那样。现在所有文件都有 LF 行结尾。不应该是 CRLF 吗?我想念什么?我在 Windows 7 上,git version 1.8.0.msysgit.0。
谢谢
【问题讨论】:
-
@VonC :我发布了
rm .git/index然后git reset但没有任何改变-我已经提交了gitattributes-无论如何奇怪的是checkout应该结帐Windows行结尾-我想念什么?我写的 gitattributes 好像没问题吧? -
@VonC :我回滚并按照程序无济于事 - 坚持使用 unix 行结尾检查
-
@VonC :显然是一个错误 - 请参阅下面的答案(并根据需要进行编辑 - 没有时间正确报告错误)
-
@patthoyts:我刚刚看到你与 git 有关,所以我会回答你的评论 - 我通常不会因为我不喜欢被光顾。我没有说我不会报道,我说我没有。然而,我确实回答了 git 邮件列表中的一个 2 岁线程,其中尽可能清楚地报告了该错误。由于我的设置并不罕见,我要么怀疑我做了一些愚蠢的事情(经过 2 天的挣扎之后变得更不可能),要么人们根本不在乎。这不是一个边缘功能 - 只需搜索 git autocrlf。如果您能提供一些见解,我们将不胜感激。
标签: git line-endings gitattributes