Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amostajo/4747630 to your computer and use it in GitHub Desktop.
Save amostajo/4747630 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# This script will make WinMerge your default tool for diff and merge.
# It must run inside git bash (on Windows)
#
#
# If you experience path issues you should give a try to the gist
# created by markusobrist at https://gist.github.com/1010253
#
# If your WinMerge is in other place then this one, please edit
WINMERGE_PATH="c:/Program Files/WinMerge"
WINMERGE_APP="WinMergeU.exe"
WINMERGE_OPTIONS="-u -e"
#
# Global setup
#
git config --global mergetool.prompt false
git config --global mergetool.keepBackup false
git config --global mergetool.keepTemporaries false
#
# Adding winmerge as a mergetool
#
git config --global merge.tool winmerge
git config --global mergetool.winmerge.name WinMerge
git config --global mergetool.winmerge.trustExitCode true
git config --global mergetool.winmerge.path "$WINMERGE_PATH"
git config --global mergetool.winmerge.cmd "$WINMERGE_APP $WINMERGE_OPTIONS -dl \"Local\" -dr \"Remote\" \$LOCAL \$REMOTE \$MERGED"
#
# Adding winmerge as a difftool
#
git config --global diff.tool winmerge
git config --global difftool.winmerge.name WinMerge
git config --global difftool.winmerge.trustExitCode true
git config --global difftool.winmerge.path "$WINMERGE_PATH"
git config --global difftool.winmerge.cmd "$WINMERGE_APP $WINMERGE_OPTIONS \$LOCAL \$REMOTE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment