Getting SourceGear DiffMerge to work with SourceTree
I had a bit of trouble getting my favourite diff tool to work with SourceTree on windows. I’m using the embedded git, which when I start a terminal seems to be MINGW32. After quite a few iterations I finally hit on a working combination, mainly based on the SourceGear documentation. For some reason the forward-slash versions of the prompts and the windows-style paths didn’t work. Here is the final config (edit your .gitconfig in your %HOMEPATH% user home directory):
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = /c/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe \"$LOCAL\" \"$REMOTE\"
[merge]
tool = diffmerge
[mergetool "diffmerge"]
trustExitCode = false
cmd = /c/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
This works correctly from the terminal and from SourceTree itself.