I'm trying to integrate WinMerge with Git as I've seen others done before on Windows 7 Ultimate.
I've followed the following steps, but an error continues to show up when I do a git mergetool which defaults to vimdiff.
Created a file called winmerge.sh in the root directory of git: C/Program Files (x86)/Git/ with: WinMergeU is the correct location.
#!/bin/sh
echo Launching WinMergeU.exe: $1 $2
"C:/Program Files (x86)/WinMerge/WinMergeU.exe"
git /e /u /dl "Base" /dr "Mine" "$1" "$2"
and used the following commands.
git config --global diff.tool winmerge
git config --global difftool.winmerge.cmd "winmerge.sh \"$LOCAL\" \"$REMOTE\""
git config --global difftool.prompt false
The error shows up as:
git config option merge.tool set to unknown tool: winmerge
You are talking about merge tool, yet you (and some other people with answers) are configuring it as a diff tool.
To configure a merge tool, you'd need to use merge.tool
and mergetool
configurations instead of diff.tool
and difftool
, like this:
git config --global merge.tool winmerge
git config --replace --global mergetool.winmerge.cmd "\"C:\Program Files (x86)\WinMerge\WinMergeU.exe\" -e -u -dl \"Base\" -dr \"Mine\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\""
git config --global mergetool.prompt false
And then you can use
git mergetool
which will open you the two files to edit.
Kudos for @dvdvck mentioning in the comments that in command line parameters you can specify a third file for the result file for winmerge (outputpath parameter).
For completeness, I'll mention that there is also this gist aimed at full configuration of winmerge for both as diff and merge tool.