Forked from adilsoncarvalho/git-mergetool-winmerge-setup.sh
Created
June 6, 2011 13:28
-
-
Save MarkusObrist/1010253 to your computer and use it in GitHub Desktop.
shell script that configures git to use WinMerge as the default tool to handle conflicts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo Launching WinMergeU.exe: $1 $2 $3 $4 | |
"C:/Program Files (x86)/WinMerge/WinMergeU.exe" -e -u -dl "Local" -dr "Remote" "$1" "$2" "$3" "$4" |
I guess you just don't have put winmerge.sh in a folder present in the PATH.
How do you then call winmerge using git and your difftool
command on one file or between two commits is what I am missing?
I tried
git difftool my_file.txt
and
git difftool
without success. Nothing happened! Would you help a newcomer to git? Thank you.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice, but didn't work for me automatically.
this works:
after running your script, i manually changed in .gitconfig
cmd = winmerge.sh $LOCAL $REMOTE $BASE $MERGED
to
cmd = ~/winmerge.sh $LOCAL $REMOTE $BASE $MERGED
(as you posted here: https://gist.github.com/758776#gistcomment-34374)