为什么git在考虑整个文件更改而只更改了一部分的情况下 [英] why git is considering the whole file changed while just a part of it is changed
问题描述
我正遇到git
的奇怪情况.我只是在一个长文件中编辑了几行,但是当我提交更改时,我看到git只是用红色突出显示了整个文件的内容.有什么问题吗?
I'm facing a strange situation with git
. I just have edited several lines in a long file but then when I went to commit changes ,I saw that git just highlighted the whole file content with a red color . what is wrong ?
我正在使用git的Windows GUI
I'm using git's windows GUI
我现在记得的一件事是,我在上次commit中将.csproj添加到了gitignore列表中.这对此有影响吗?
Edit : one thing I remember now is that I added .csproj to the gitignore list in last commit . does this has any effect on this ?
更新:朋友建议的问题是从行尾开始.我使用此问题的
Update : the problem as friends suggested was from line ending . I solved it using this question's answer
推荐答案
问题是由于行尾引起的.
git config core.autocrlf
设置为 true .我使用了这2篇文章中提到的解决方案
git config core.autocrlf
was set to true . I used solutions mentioned in this 2 posts
尝试使用git filter-branch修复行尾,但没有运气
并将其设置为 false .解决了.
and set it as false . and it is solved.
这篇关于为什么git在考虑整个文件更改而只更改了一部分的情况下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!