簡體   English   中英

如何讓Visual Studio在git下顯示合並沖突?

[英]How can I get Visual Studio to show merge conflicts under git?

我正在使用Visual Studio 2015 Pro並使用Gi​​t repo。 假設我做了拉動或應用隱藏的更改或做了一些導致我的分支發生沖突的事情。 例如,在這種情況下,我只是應用了一個存儲:

在此輸入圖像描述

正如您所看到的,我有一些更改,但Web.config存在沖突。 為什么始終存在沖突的XML文件?

現在,我進入Visual Studio並轉到Team Explorer-> Changes

在此輸入圖像描述

在這里,我看到我的暫存的變更,但也有不分級的零個變化。 我想知道為什么Web.config沒有顯示在這里,所以我可以解決沖突。

兩件事情:

  1. 相信如果我使用Visual Studio進行Pull ,它會檢測到然后運行合並工具的沖突。 我還沒有嘗試過,但我知道它對TFS有用。 但是,我想知道我是否可以從命令行使用git pull然后使用Visual Studio來解決沖突。
  2. git config --global merge.tool已經vsdiffmerge所以如果我要運行git mergetool命令行,那就使用Visual Studio合並。 但是,這樣做會產生一個全新的Visual Studio實例,這個實例很慢而且很煩人,並且不允許我在我的項目的其余部分中工作。

有人對這個有任何見解嗎? 謝謝!

在Visual Studio Professional 2017 15.7.4中,“ 更改”窗口似乎顯示沖突。

在此輸入圖像描述

設置:

/mnt/c/git/ConsoleApp1>git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   ConsoleApp1/Class1.cs
        modified:   ConsoleApp1/Program.cs

/mnt/c/git/ConsoleApp1>git stash apply
Auto-merging ConsoleApp1/Program.cs
CONFLICT (content): Merge conflict in ConsoleApp1/Program.cs
/mnt/c/git/ConsoleApp1>git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   ConsoleApp1/Class1.cs

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

        both modified:      ConsoleApp1/Program.cs

/mnt/c/git/ConsoleApp1>

有顏色:

在此輸入圖像描述

暫無
暫無

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

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