Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dkordik/5715480 to your computer and use it in GitHub Desktop.
Save dkordik/5715480 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 your WinMerge is in other place then this one, please edit
WINMERGE_SCRIPT="~/winmerge-merge.sh"
#
# 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.cmd "$WINMERGE_SCRIPT \$LOCAL \$REMOTE \$BASE \$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.cmd "$WINMERGE_SCRIPT \$LOCAL \$REMOTE"
#!/bin/sh
C1=''
C2=''
C3=''
C4=''
if [ -n "$1" ]; then
C1=`cygpath -w $1`
fi
if [ -n "$2" ]; then
C2=`cygpath -w $2`
fi
if [ -n "$3" ]; then
C3=`cygpath -w $3`
fi
if [ -n "$4" ]; then
C4=`cygpath -w $4`
fi
echo Launching WinMergeU.exe: 1:$C1 2:$C2 3:$C3 4:$C4
"C:/Program Files (x86)/WinMerge/WinMergeU.exe" -e -u -dl "Local" -dr "Remote" "$C1" "$C2" "$C3" "$C4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment