Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Git config to use vsdiffmerge.exe as a diff/merge tool
# PLEASE SEE FEEDBACK. This script is not up to date and may not use the best practices.
[diff]
tool = vsdiffmerge
[difftool]
prompt = false
[difftool "vsdiffmerge"]
cmd = '"C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/vsdiffmerge.exe"' "$LOCAL" "$REMOTE" //t
keepbackup = false
trustexitcode = true
[merge]
tool = vsdiffmerge
[mergetool]
prompt = false
[mergetool "vsdiffmerge"]
cmd = '"C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/vsdiffmerge.exe"' "$REMOTE" "$LOCAL" "$BASE" "$MERGED" //m
keepbackup = false
trustexitcode = true
@JunielKatarn
Copy link
Author

JunielKatarn commented Apr 20, 2016

Usage:
git difftool ${file1} ${file2}
git mergetool ${file}

@aaron-ni
Copy link

aaron-ni commented Mar 12, 2019

As a warning, setting diff.tool causes issues in Visual Studio 2017 Update 9.7 and Visual Studio 2019 Preview 4/RC (like merges outputting a blank file rather than the merged content). It is much safer not to modify diff.tool and instead invoke this via git difftool --tool vsdiffmerge.

@BBI-YggyKing
Copy link

BBI-YggyKing commented Jan 26, 2021

Note that git gui internally implements its own command line formatting for each supported diff tool (see mergetool.tcl), so this doesn't work for invocation by right-clicking in the diff view of git gui.

@JunielKatarn
Copy link
Author

JunielKatarn commented Jan 26, 2021

Note that git gui internally implements its own command line formatting for each supported diff tool (see mergetool.tcl), so this doesn't work for invocation by right-clicking in the diff view of git gui.

Thanks for the tip.
I have not used this config in a long time, but may update so it's correct.

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