How to configure visual studio 2017 to use external difftool and mergetool

masiboo picture masiboo · Oct 15, 2017 · Viewed 7k times · Source

I configured DiffMerge for difftool and mergetool in git global configuration. I read that Visual Studio honors this settings of global git configuration. Here is my git config:

git config  --global --list
difftool.DiffMerge.cmd='C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' $LOCAL $REMOTE
merge.tool=DiffMerge
mergetool.DiffMerge.cmd='C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' -merge -result=$PWD/$MERGED $PWD/$LOCAL $PWD/$BASE $PWD/$REMOTE
mergetool.DiffMerge.trustexitcode=true
user.name=masiboo
[email protected]

But if try to see diff from visual studio, it opens vs own diff tool. How can I open or configure to open external tool?

Answer

Hagay Goshen picture Hagay Goshen · Nov 29, 2017

Took me a while also.

It seems that visual studio 2017 "helps" you , and if something is wrong it just launches the visual studio diff.

Here is my working .gitconfig settings :

[diff]
    tool = winmerge

[difftool "winmerge"]  
  trustExitCode = true
  cmd = \"C:\\Program Files (x86)\\WinMerge\\WinMergeU.exe\" -u -e \"$LOCAL\" \"$REMOTE\"

Do note that visual studio seems to insert a repository level config with diff tools settings , in that case you need to clear the .git/config settings on your repository.