为什么vsdiffmerge总是打开一个新的VisualStudio而不显示差异

时间:2017-11-09 02:19:57

标签: git visual-studio git-difftool

我想使用vsdiffmerge作为git diff工具。我在下面设置了.git/config

[diff]
    tool = vsdiffmerge
[difftool]
      prompt = true
[difftool "vsdiffmerge"]
      cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
      keepbackup = false
      trustexistcode = true
[merge]
      tool = vsdiffmerge
[mergetool]
      prompt = true
[mergetool "vsdiffmerge"]
      cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe\" \"$LOCAL\" \"$REMOTE\" //t //m
      keepbackup = false
      trustexistcode = true

我发现它可以很好地工作,但它会打开一个新的VisualStudio而不显示diff选项卡。我尝试删除//t但没有帮助。

我想问两个问题:

  1. 如何让vsdiffmer在打开的VisualStudio中打开diff选项卡?

  2. 如果我不想将所有文件输入y,请使用git diff多文件。我看到文件的数量是133,我应该按133 y

1 个答案:

答案 0 :(得分:1)

difftool和mergetool的命令应该有所不同:

尝试一下:

  • Difftool命令:/ t“ $ LOCAL”“ $ REMOTE”

  • MergeTool命令:/ m / t“ $ LOCAL”“ $ REMOTE”“ $ BASE”“ $ MERGED”

这是Visual Studio 2019的示例,但对于Visual Studion 2017应该类似:

difftool.vsdiffmerge.path=C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsDiffMerge.exe
difftool.vsdiffmerge.cmd=/t "$LOCAL" "$REMOTE"
mergetool.vsdiffmerge.path=C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsDiffMerge.exe
mergetool.vsdiffmerge.cmd=/m /t "$LOCAL" "$REMOTE" "$BASE" "$MERGED"

我从GitExtensions使用/午餐,但与其他git Client应用程序非常相似。