I'm just starting to work with Git. I would like to use TortoiseMerge as the difftool and mergetool.
In my .gtconfig in my personal user directory 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.
When rebasing, I strongly recommend switch
$theirs
and$mine
, because it is different when you merge and rebase-merge. Check here:What is the precise meaning of "ours" and "theirs" in git?
So, if you only use mergetool to rebase like me, do:
Great answer by Klas Mellbourn! Saved me a lotta time. One shortcoming is, newly
Added
orRemoved
files in the repository will not show up during the difftool command execution. There's nothing to compare them to! Here's what I did on top of this: (Inspired by my co-worker's answer).empty.empty
in$Home
directory (executestart ~
in your bash). And as the name suggests, keep it empty.tortoisediff.sh
in$Home/bin
directory with following content:
Modify your .gitconfig file (Line 11 of the answer)
cmd = tortoisediff.sh "$LOCAL" "$REMOTE"
This would now make difftool refer to tortoisediff.sh instead of opening the application directly.
git add .
followed bygit difftool --staged
instead of simplygit difftool
.The following settings work fine for me. However, I am using TortoiseGit not TortoiseSVN. Notice the difference in the parameters for diff.
This worked for me, using TortoiseMerge 1.6.7 (Portable)
So that filenames with spaces are handled correctly, you should change the last line of @melbourn's answer to