deadlydog deadlydog - 1 month ago 7
Git Question

How to use an external diff tool for Git in Visual Studio 2013?

I've found this post that explains how you can have Visual Studio 2013 use the built-in diff tool when comparing files in Git, but I'm having the opposite problem. Right now when I right-click on a file in the Git

Commit Details
window and choose
Compare With Previous...
VS performs the diff in the default Visual Studio 2013 compare tool, but I want it to use an external diff tool, specifically TortoiseMerge.exe. I have it specified in my C:\Users\[My Name]\.gitconfig and it works properly from the GitBash console, but Visual Studio ignores this setting and always uses its built-in tool.

This is what I have in that .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


I have also checked my local repository's .gitconfig to make sure it wasn't overriding this setting, and it does not specify any diff or difftool settings.

I have also tried similar settings in my .gitconfig like:

[diff]
guitool = TortoiseMerge
[difftool "TortoiseMerge"]
cmd = \"C:/Program Files/TortoiseSVN/bin/TortoiseMerge.exe\" /base:"$REMOTE" /local:"$MINE"


but the behavior does not change.

Answer

Visual Studio uses the diff.tool configuration setting, not the diff.guitool configuration setting.

Try:

[diff]
    tool = TortoiseMerge