git diff显示git重置后的差异

时间:2017-07-20 15:15:20

标签: git

我的git repo中有几个二进制文件拒绝认为自己没有变化。这是一个Windows环境,所以我要做的第一件事就是检查autocrlf:

> git config core.autocrlf
false

现在我重置以摆脱任何变化:

> git reset --hard
HEAD is now at 6d67f13

现在我检查差异:

> git diff
warning: CRLF will be replaced by LF in resources/public/fontawesome/fonts/fontawesome-webfont.eot.
The file will have its original line endings in your working directory.
diff --git a/resources/public/fontawesome/fonts/fontawesome-webfont.eot b/resources/public/fontawesome/fonts/fontawesome-webfont.eot
index 33b2bb8..ec6fb3a 100644
Binary files a/resources/public/fontawesome/fonts/fontawesome-webfont.eot and b/resources/public/fontawesome/fonts/fontawesome-webfont.eot differ
diff --git a/resources/public/fontawesome/fonts/fontawesome-webfont.woff2 b/resources/public/fontawesome/fonts/fontawesome-webfont.woff2
index 3311d58..680a9dd 100644
Binary files a/resources/public/fontawesome/fonts/fontawesome-webfont.woff2 and b/resources/public/fontawesome/fonts/fontawesome-webfont.woff2 differ
warning: CRLF will be replaced by LF in resources/public/fontawesome/fonts/fontawesome-webfont.woff2.
The file will have its original line endings in your working directory.

我的理解是,如果将autocrlf设置为false,则不应发生上述警告。此外,这些都是二进制文件,因此不应该发生这样的替换。我错过了什么?

1 个答案:

答案 0 :(得分:0)

感谢@torek的提示。问题似乎是具有以下行的项目中的.gitattributes文件:

* text eol=lf

取出"文字"有点似乎解决了这个问题。