Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 665
masiboo Avatar asked Oct 15 '17 09:10

masiboo


2 Answers

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.

like image 114
Hagay Goshen Avatar answered Sep 25 '22 04:09

Hagay Goshen


to use VS code as diff tool i add this to my local git config file, works in VS2019.

[diff]
    tool = vscode
[difftool "vscode"]
    cmd = "code --wait --diff \"$LOCAL\" \"$REMOTE\" "
like image 26
Khaled alShaibani Avatar answered Sep 23 '22 04:09

Khaled alShaibani