Can TortoiseMerge be used as a difftool with Windows Git Bash?

Rich Shealer picture Rich Shealer · May 11, 2013 · Viewed 17.7k times · Source

I'm just starting to work with Git. I would like to use TortoiseMerge as the difftool and mergetool.

In my $HOME/.gitconfig I have the following sections. I've removed the user and color sections for this question.

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

If I type tortoisemerge at the Git Bash prompt it loads. It is known to be on the path. But if I type the command I get the following error.

Rich:mygittest (master *)
$ git difftool
error: 'tortoisemerge' can only be used to resolve merges
merge tool candidates: kompare emerge vimdiff
No known merge resolution program available.
external diff died, stopping at readme.txt.
Rich:mygittest (master *)
$ 

What am I not understanding to make this work? Tortoisemerge is installed with TortoiseSVN.

Answer

Klas Mellbourn picture Klas Mellbourn · May 11, 2013

The following settings work fine for me. However, I am using TortoiseGit not TortoiseSVN. Notice the difference in the parameters for diff.

[diff]
  tool = tortoisediff
[difftool]
  prompt = false
[merge]
  tool = tortoisemerge
[mergetool]
  prompt = false
  keepBackup = false
[difftool "tortoisediff"]
  cmd = \""c:/Program Files/TortoiseGIT/bin/TortoiseGitMerge.exe"\" -mine "$REMOTE" -base "$LOCAL"
[mergetool "tortoisemerge"]
  cmd = \""c:/Program Files/TortoiseGIT/bin/TortoiseGitMerge.exe"\" -base "$BASE" -theirs "$REMOTE" -mine "$LOCAL" -merged "$MERGED"