If you’ve reached this post by way of a search engine, I’m guessing it’s at least the fifth, sixth, or twentieth one you’ve looked at trying to understand why the hell git mergetool
doesn’t launch DiffMerge. Or why git mergetool -tool-help
tells you “blah blah blah The following tools are valid, but not currently available: blah blah diffmerge blah blah”. Or: “The merge tool diffmerge is not available as ‘diffmerge’”. You’ve already done everything you think you need to do in order to get DiffMerge and Git playing nicely together, right? I mean, the first two hits for “git diffmerge” provide instructions that are pretty straightforward, are they not?
So what gives??
Could it be, that you’ve previously used SourceTree? If so, did you configure it to use DiffMerge? Because if you did, that might be the problem. Run git config -global -e
and see what comes up. Are your DiffMerge settings listed under [difftool "sourcetree"]
and/or [mergetool "sourcetree"]
? Yes? Then try replacing “sourcetree” with “diffmerge” and see what happens. That change fixed me right up. (If that doesn’t work, sorry; you’re off to your sixth, seventh, or twenty-first post…)
Now, my guess is that SourceTree does, in fact, need the [difftool "sourcetree"]
and/or [mergetool "sourcetree"]
sections in order to work correctly with DiffMerge. (I didn’t actually confirm it, so it remains just a guess.) If you want to continue using DiffMerge with SourceTree, you’ll probably need two separate difftool
and mergetool
sections: one for use with the command line and the other for SourceTree. If you’re so inclined you can test my theory. Personally, I’m trying to get away from SourceTree. I prefer GitHub For Windows and the command line.
One last thing worth mentioning. Even though the instructions I referred to above for configuring Git with DiffMerge are straightforward, they still require multiple copy-paste-enter’s. Wouldn’t it be even simpler to just copy/paste once? Behold! I offer you this gist containing all the necessary settings. Open your Git config in a text editor, copy/paste, save, done. Woot woot.