簡體   English   中英

VS2015,Git和撤消

[英]VS2015, Git and undo

在Git存儲庫中工作時,VS2015中的undo出現了一個奇怪的問題。 更改例如web.config,如果我撤消更改,則內容將更改為未修改的版本。 但是,即使文件沒有更改,該文件仍顯示為已更改的文件。

Se屏幕投射: https//jnus.tinytake.com/sf/MTIwNjg0OF80NjMzMDc1

使用以下配置:.gitconfig

[core]
    fscache = true
    preloadindex = true
    autocrlf = true

.gitattribute

* text=auto

知道為什么會這樣。 我懷疑行結尾(當前使用CRLF),但無法確認這一點。

git diff的示例: 在此處輸入圖片說明

更新:我嘗試使用以下別名對行尾進行歸一化,沒有任何運氣。

git rm --cached -r . && git reset --hard && git commit -a -m 'Normalize CRLF' -n

更新2:似乎只影響基於XML的文件,例如csproj,co​​nfig等。

我建議檢查一下git所說的內容:

  • 使用shell和git status或TortoiseGit,查看是否具有暫存版本和未暫存版本
  • 使用git diff ,查看修改后的內容

Ok找到了一個解決方案,該解決方案使用上述.gitattribute修復了我們所有解決方案中的所有行尾(准確的是240萬個結尾)。 在此之后,撤消問題消失了。

$ 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"

嘗試用git filter-branch修復行尾,但沒有運氣

這確實是一個PITA,對於團隊來說,這不是Windows / Visual Studio上git的很好的初識。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM