Skip to content

Instantly share code, notes, and snippets.

@JunielKatarn
Last active March 29, 2024 00:03
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JunielKatarn/530005dd432e2bd4552c856d4f886cc7 to your computer and use it in GitHub Desktop.
Save JunielKatarn/530005dd432e2bd4552c856d4f886cc7 to your computer and use it in GitHub Desktop.
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

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

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

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