So I've seen a few questions about getting DiffMerge to be the mergetool
and difftool
for git. Essentially it comes down to having DiffMerge (sgdm.exe) in your PATH
and a .gitconfig
that looks like:
[diff]
tool = DiffMerge
[difftool "DiffMerge"]
cmd = 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' "$LOCAL" "$REMOTE"
[merge]
tool = DiffMerge
[mergetool "DiffMerge"]
cmd = 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' -merge -result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"
trustExitCode = true
keepBackup = false
When I run git difftool file1 file2
, nothing happens. No error code, no launching of DiffMerge. From Git Bash and a Windows Command Line, I can run sgdm file1 file2
and DiffMerge comes up.
I've modified the cmd
in the .gitconfig
to not have a path or extensions (e.g. sgdm
only), but still to no avail.
Has anyone encountered this? Are there some obvious things I'm missing? I feel like I'm missing something obvious.
following worked for me-
git config --global diff.tool diffmerge git config --global difftool.diffmerge.cmd 'C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe "$LOCAL" "$REMOTE"' git config --global merge.tool diffmerge git config --global mergetool.diffmerge.trustExitCode true git config --global mergetool.diffmerge.cmd 'C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe -merge -result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"'
My .gitconfig
for using SourceGear DiffMerge is:
[mergetool "diffmerge"]
cmd = \"C:\\program files\\sourcegear\\common\\diffmerge\\sgdm.exe\" --merge --result=$MERGED $LOCAL $BASE $REMOTE
(Obviously, flip $LOCAL
and $REMOTE
if you prefer them on the other side.)
This has worked well for me for quite a while. (Windows 7, latest version of Git.)
Make sure sgdm.exe is in the environment path.
[diff]
tool = sgdm
[difftool "diffmerge"]
cmd = sgdm $LOCAL $REMOTE
[merge]
tool = sgdm
[mergetool "diffmerge"]
cmd = sgdm --merge --result=$MERGED $LOCAL $BASE $REMOTE
trustexitcode = false
[difftool "sgdm"]
cmd = sgdm $LOCAL $REMOTE
[mergetool "sgdm"]
trustexitcode = false
cmd = sgdm --merge --result=$MERGED $LOCAL $MERGED $REMOTE --title1=Mine --title2='Merged: $MERGED' --title3=Theirs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With