[英]VS2015, Git and undo
Got a weird problem with undo in VS2015 when working in a Git repo. 在Git存储库中工作时,VS2015中的undo出现了一个奇怪的问题。 Change eg web.config and if I undo the change, the content is changed to the unmodified version.
更改例如web.config,如果我撤消更改,则内容将更改为未修改的版本。 However the file still shows up as a changed file, even though there's no changes in the file.
但是,即使文件没有更改,该文件仍显示为已更改的文件。
Se screen cast: https://jnus.tinytake.com/sf/MTIwNjg0OF80NjMzMDc1 Se屏幕投射: https : //jnus.tinytake.com/sf/MTIwNjg0OF80NjMzMDc1
Using following config: .gitconfig 使用以下配置:.gitconfig
[core]
fscache = true
preloadindex = true
autocrlf = true
.gitattribute .gitattribute
* text=auto
Any idea why this is happening. 知道为什么会这样。 I suspect line ending (currently using CRLF), but haven't been able to confirm this.
我怀疑行结尾(当前使用CRLF),但无法确认这一点。
Example of a git diff: git diff的示例:
UPDATE: I've tried to normalize line endings, without any luck, with the following alias. 更新:我尝试使用以下别名对行尾进行归一化,没有任何运气。
git rm --cached -r . && git reset --hard && git commit -a -m 'Normalize CRLF' -n
UPDATE 2: Seems to impact only XML based files like csproj, config etc. 更新2:似乎只影响基于XML的文件,例如csproj,config等。
I'd suggest to inspect what git says : 我建议检查一下git所说的内容:
git status
, or TortoiseGit, see if you have both a staged version and an unstaged version git status
或TortoiseGit,查看是否具有暂存版本和未暂存版本 git diff
, see what shows up as modifications git diff
,查看修改后的内容 Ok found a solution to fix all line endings (2.4M endings to be exact) in our solution with the above mentioned .gitattribute. Ok找到了一个解决方案,该解决方案使用上述.gitattribute修复了我们所有解决方案中的所有行尾(准确的是240万个结尾)。 And after this, the undo problem is gone.
在此之后,撤消问题消失了。
$ echo "* text=auto" >>.gitattributes
$ rm .git/index # Remove the index to force git to
$ git reset # re-scan the working directory
$ git status # Show files that will be normalized
$ git add -u
$ git add .gitattributes
$ git commit -m "Introduce end-of-line normalization"
From Trying to fix line-endings with git filter-branch, but having no luck 从尝试用git filter-branch修复行尾,但没有运气
This has really been a PITA, and not a very good first acquaintance with git on Windows/Visual Studio for the team. 这确实是一个PITA,对于团队来说,这不是Windows / Visual Studio上git的很好的初识。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.