Created
December 29, 2010 17:24
-
-
Save adilsoncarvalho/758776 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 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" |
That's great. Wouldn't you like to change my gist to preserve your solution? or if you create a new one give me the link to it
I forked your gist and added my changes here:
https://gist.github.com/1010253
Hope that's alright with you?
Hi @adilsoncarvalho and @MarkusObrist,
Very useful scripts, thanks to both of you. I fixed the spaces problem by adding the WinMerge directory to PATH.
I found a difference in the third parameters for the merge tool configuration in both versions:
@adilsoncarvalho: $LOCAL $REMOTE $MERGED
@MarkusObrist: $LOCAL $REMOTE $BASE $MERGED
I also think the forth parameter will be ignored by WinMerge.
Can you clarify?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for completions sake the entry in the gitconfig file:
cmd = ~/winmerge.sh $LOCAL $REMOTE $BASE $MERGED