Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I use TortoiseMerge as my git merge tool on Windows?

I'm trying to perform my first Git merge ever (exciting!), but can't get Git Gui (0.13.GITGUI from Git 1.7.4.msysgit.0) to recognize TortoiseMerge (1.6.11.20210 x64) on Windows 7. Based on an answer to a similar question, I've made the following configuration changes:

$ git config --global merge.tool tortoisemerge $ git config --global mergetool.tortoisemerge.cmd 'TortoiseMerge.exe -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"' $ git config --global --list ...snip... merge.tool=tortoisemerge mergetool.tortoisemerge.cmd=TortoiseMerge.exe -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED" $ 

Unfortunately, when I start Git Gui and attempt to "Run Merge Tool", I receive the error Unsupported merge tool 'tortoisemerge'.

Can anyone tell me what I've done wrong? Here's the relevant sections of my ~/.gitconfig:

[merge]         tool = tortoisemerge [mergetool "tortoisemerge"]         cmd = TortoiseMerge.exe -base:\"$BASE\" -mine:\"$LOCAL\" -theirs:\"$REMOTE\" -merged:\"$MERGED\" 

Update

TortoiseMerge works fine with the above config when running git mergetool from the command line. It seems that only Git Gui has problems with it. :-/

like image 449
Ben Blank Avatar asked Mar 04 '11 05:03

Ben Blank


People also ask

How do I merge tools in git?

Use git mergetool to run one of several merge utilities to resolve merge conflicts. It is typically run after git merge. If one or more <file> parameters are given, the merge tool program will be run to resolve differences on each file (skipping those without conflicts).


2 Answers

If you have the latest git, run this command line once:

git config merge.tool tortoisemerge

Important: Do not add a .exe extension to the command.

If that fails, or if you want to add a different merge tool that git doesn't know about, do this:

Open one of the following in an editor:

  • 64-bit git: C:\Program Files\Git\mingw64\share\git-gui\lib\mergetool.tcl
  • 32-bit git: C:\Program Files (x86)\Git\share\git-gui\lib\mergetool.tcl

Add something like this to mergetool.tcl:

tortoisemerge {     set cmdline [list TortoiseMerge.exe -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"] } 

Put the new tortoisemerge entry above this other code:

default {         error_popup [mc "Unsupported merge tool '%s'" $tool]         return } 

Bonus example:

To use SourceGear diffmerge, add this to mergetool.tcl:

diffmerge {     set cmdline [list "C:/Program Files (x86)/SourceGear/DiffMerge/DiffMerge.exe" --merge --result=$MERGED $LOCAL $BASE $REMOTE] } 
like image 133
Winter Dragoness Avatar answered Sep 19 '22 15:09

Winter Dragoness


Try this:

[merge] tool = tortoise  [mergetool "tortoise"] cmd = "TortoiseMerge.exe" -base:"$BASE" -theirs:"$REMOTE" -mine:"$LOCAL" -merged:"$MERGED" 

Source: http://programmersunlimited.wordpress.com/2010/07/01/getting-git-to-use-tortoisemerge/

like image 38
Jake Avatar answered Sep 20 '22 15:09

Jake