Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make WinMerge my git mergetool?

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 
like image 705
Wei Jin Avatar asked May 23 '12 05:05

Wei Jin


People also ask

How do you set beyond compare as Mergetool?

Launch Beyond Compare, go to the Beyond Compare menu and run Install Command Line Tools. Open Tower's preferences dialog on the Git Config Tab. Set the Diff Tool drop-down to Beyond Compare. Set the Merge tool drop-down to Beyond Compare.

What do I do after git Mergetool?

It's generally best to take that message and add any extra information rather than write your own from scratch. Developers who use git will automatically recognize git's merge commits but may not recognize your custom merge messages immediately.


1 Answers

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.

like image 137
eis Avatar answered Sep 20 '22 10:09

eis