Skip to content

Instantly share code, notes, and snippets.

@DamianReeves
Created April 18, 2015 01:44
Show Gist options
  • Save DamianReeves/35adf89992f8d871afe6 to your computer and use it in GitHub Desktop.
Save DamianReeves/35adf89992f8d871afe6 to your computer and use it in GitHub Desktop.
Using Visual Studio AS Git Merge Tool
[diff]
tool = vsdiffmerge
[difftool]
prompt = true
[difftool "vsdiffmerge"]
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\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 12.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m
keepbackup = false
trustexistcode = true
@cdroulers
Copy link

Works great, Thanks!

For VS2015, simply change Microsoft Visual Studio 12.0 to Microsoft Visual Studio 14.0!

@martinfletcher
Copy link

For VS2017:

cmd = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsdiffmerge.exe"

@kmcginnes
Copy link

I found the following to work for VS 2017:

[difftool "visualstudio"]
    cmd = 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsdiffmerge.exe' $LOCAL $REMOTE Source Target //ignorespace //t
[mergetool "visualstudio"]
    cmd = 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsdiffmerge.exe' $LOCAL $REMOTE $BASE $MERGED //ignorespace //m
    trustExitCode = true

@rosdi
Copy link

rosdi commented Mar 23, 2017

So is it "$REMOTE\" \"$LOCAL\" or "$LOCAL" "$REMOTE" ? Example shown by @kmcginnes seems more consistent? Or does it even matter?

@peheje
Copy link

peheje commented Feb 19, 2018

Is there any way to make it work with dir diff? git difftool --dir-diff

@stokedout
Copy link

Should trustexistcode exist not be trustexitcode exit ?

@ankitvijay
Copy link

ankitvijay commented Dec 24, 2019

For Visual Studio 2019 Professional:

[diff]
tool = vsdiffmerge
[difftool]
prompt = true
[difftool "vsdiffmerge"]
cmd = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsdiffmerge.exe' $LOCAL $REMOTE Source Target //ignorespace //t
keepbackup = false
trustexistcode = true

[merge]
tool = vsdiffmerge
[mergetool]
prompt = true
[mergetool "vsdiffmerge"]
cmd = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsdiffmerge.exe' $LOCAL $REMOTE $BASE $MERGED //ignorespace //m
keepbackup = false
trustexistcode = true

For Visual Studio 2019 Enterprise:
[diff]
tool = vsdiffmerge
[difftool]
prompt = true
[difftool "vsdiffmerge"]
cmd = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsdiffmerge.exe' $LOCAL $REMOTE Source Target //ignorespace //t
keepbackup = false
trustexistcode = true

[merge]
tool = vsdiffmerge
[mergetool]
prompt = true
[mergetool "vsdiffmerge"]
cmd = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsdiffmerge.exe' $LOCAL $REMOTE $BASE $MERGED //ignorespace //m
keepbackup = false
trustexistcode = true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment