Nik*_*des 5 git git-diff github-for-windows
我正在使用GitHub for Windows客户端,现在它似乎表明即使diff是空的,也存在未经修改的更改.
我已经尝试提交空差异,但我仍然一遍又一遍地得到同样的东西.
我输入git status了Shell,这就是我得到的:
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]>
Run Code Online (Sandbox Code Playgroud)
这是输出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.
Run Code Online (Sandbox Code Playgroud)
这样做的原因是git的功能是在不同的行结尾之间自动转换,这通常是不受欢迎的,因为编辑器无论如何都要处理这个问题.
您可以使用以下方法禁用该功能
git config core.autocrlf false
Run Code Online (Sandbox Code Playgroud)
并使用以下方法重置更改:
git reset --hard # This will reset any changes in your working directory, make sure to save the important changes.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1222 次 |
| 最近记录: |