git - Visual Studio团队资源管理器显示了实际上不存在的更改

3
我最近尝试使用git-svn和git在Visual Studio 2013中进行集成。但是,我遇到了一个问题,即Visual Studio显示许多文件作为“已包含更改”(即“修改”的文件),而实际上它们并没有更改。
初步研究表明,当存在行尾问题时会出现类似的问题,但是:
A)控制台中的Git运行正常(即git status不显示任何更改)。
B)Git行尾规范化已关闭(通过“git config --global core.autocrlf false”和“.gitattributes”文件中的“* text=off line”)。
有什么想法吗?
2个回答

1

首先:

  • Use the latest 2.13.2 version of Git (unless Visual Studio 2013 is still based on libgit2, but even though, check if the issue persists in command line, with Git 2.13.2)
  • make sure eol is not involved in your current local repo by triggering a renormalization:

    $ rm .git/index     # Remove the index to re-scan the working directory
    $ git add .
    $ git status        # Check if files are still "modified"
    
第二步,使用以下方法检查那些“不可见”的更改的性质:
git diff --word-diff-regex=.
# or
git -c color.diff.whitespace="red reverse" diff -R -- afile

第三步,检查是否存在权限问题(您可以先取消设置其他core.filemode设置):
git config core.filemode false
# renormalize as shown above.

0
从@Vonc的回答中,我已经检查并发现即使是VS 2015也仍在使用libgit2,您可以在“%PROGRAMFILES(x86)%\Microsoft Visual Studio 14.0\Web\External\git”文件夹中确认。
要确认Git-SCM中的文件修改是否真实,请使用标准Git并运行以下命令以查看更改。
git diff --name-status

大多数情况下,您不会看到任何更改。

顺便说一句,我发现 VS 2017 切换到使用标准的 Git-SCM。如果您使用这个版本打开,它将不会有任何问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接