我发现this post解释了在比较Git中的文件时如何让Visual Studio 2013使用内置差异工具,但我遇到了相反的问题。现在,当我右键单击Git Commit Details
窗口中的文件并选择Compare With Previous...
VS在默认的Visual Studio 2013比较工具中执行diff时,我希望它使用外部diff工具,特别是TortoiseMerge.exe。我在我的C:\ Users \ [我的名字] \ .gitconfig中指定了它,它可以从GitBash控制台正常工作,但Visual Studio忽略了这个设置,并且总是使用它的内置工具。
这就是我的.gitconfig:
[merge]
tool = kdiff3
[mergetool "kdiff3"]
path = c:/Program Files (x86)/KDiff3/kdiff3.exe
[diff]
guitool = TortoiseMerge
[difftool "TortoiseMerge"]
path = C:/Program Files/TortoiseSVN/bin/TortoiseMerge.exe
我还检查了我的本地存储库的.gitconfig以确保它没有覆盖此设置,并且它没有指定任何diff或difftool设置。
我也在我的.gitconfig中尝试过类似的设置,如:
[diff]
guitool = TortoiseMerge
[difftool "TortoiseMerge"]
cmd = \"C:/Program Files/TortoiseSVN/bin/TortoiseMerge.exe\" /base:"$REMOTE" /local:"$MINE"
但行为不会改变。
答案 0 :(得分:6)
Visual Studio使用diff.tool
配置设置,而不是diff.guitool
配置设置。
尝试:
[diff]
tool = TortoiseMerge
答案 1 :(得分:0)
我最近在Visual Studio 2012中遇到了同样的问题。我将在此处发布解决方案,因为这是我在搜索时找到的第一个帖子。
我的.gitconfig文件如下所示:
[merge]
tool = kdiff3
[diff]
tool = kdiff3
[difftool]
prompt = true
[difftool "kdiff3"]
path = "C:/Program Files/KDiff3/kdiff3.exe"
keepBackup = false
trustExitCode = true
[mergetool]
prompt = true
[mergetool "kdiff3"]
cmd = "C:/Program Files/KDiff3/kdiff3.exe" $BASE $LOCAL $REMOTE -o $MERGED
keepBackup = false
trustExitCode = true
[mergetool "vsdiffmerge"]
cmd = "C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe" /m $REMOTE $LOCAL $BASE $MERGED
keepbackup = false
trustexistcode = true
问题是配置部分之间的换行符。
将文件更改为此工作正常:
[merge]
tool = kdiff3
[diff]
tool = kdiff3
[difftool]
prompt = true
[difftool "kdiff3"]
path = "C:/Program Files/KDiff3/kdiff3.exe"
keepBackup = false
trustExitCode = true
[mergetool]
prompt = true
[mergetool "kdiff3"]
cmd = "C:/Program Files/KDiff3/kdiff3.exe" $BASE $LOCAL $REMOTE -o $MERGED
keepBackup = false
trustExitCode = true
[mergetool "vsdiffmerge"]
cmd = "C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe" /m $REMOTE $LOCAL $BASE $MERGED
keepbackup = false
trustexistcode = true