GitHub for Windows表示即使差异为空,也存在未经修改的更改

时间:2014-03-22 20:46:24

标签: git git-diff github-for-windows

我正在使用GitHub for Windows客户端,现在它似乎表明即使差异为空也存在未经修改的更改。

我已经尝试提交空差异,但我仍然一遍又一遍地做同样的事情。

我在Shell中键入了git status,这就是我得到的:

C:\Users\Nicholas\Documents\GitHub\Vesper.next [master +0 ~6 -0]> git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified:   LICENSE.txt
modified:   README.md
modified:   v.next/css/ext-styleNext.css
modified:   v.next/js/ext-globalVariables.js
modified:   v.next/js/modernizr.js
modified:   v.next/js/numeric.js

no changes added to commit (use "git add" and/or "git commit -a")
C:\Users\Nicholas\Documents\GitHub\Vesper.next [master +0 ~6 -0]>

这是git diff

的输出
C:\Users\Nicholas\Documents\GitHub\Vesper.next [master +0 ~6 -0]> git diff
warning: LF will be replaced by CRLF in LICENSE.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in v.next/css/ext-styleNext.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in v.next/js/ext-globalVariables.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in v.next/js/modernizr.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in v.next/js/numeric.js.
The file will have its original line endings in your working directory.

1 个答案:

答案 0 :(得分:6)

这样做的原因是git的功能可以在不同的行结尾之间自动转换,这通常是不受欢迎的,因为编辑器无论如何都要处理这个问题。

您可以使用以下方法禁用该功能:

git config core.autocrlf false

使用以下方法重置更改:

git reset --hard # This will reset any changes in your working directory, make sure to save the important changes.