Skip to content

Instantly share code, notes, and snippets.

@mkchandler
Last active January 13, 2022 10:44
Show Gist options
  • Save mkchandler/2377564 to your computer and use it in GitHub Desktop.
Save mkchandler/2377564 to your computer and use it in GitHub Desktop.
Setup guide for making Git recognize and use SourceGear DiffMerge.
  1. Download SourceGear DiffMerge: http://sourcegear.com/diffmerge/index.html

  2. Add the following to your global .gitconfig file:

     [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="$PWD/$MERGED" "$PWD/$LOCAL" "$PWD/$BASE" "$PWD/$REMOTE"
         trustExitCode = true
     [mergetool]
         keepBackup = false
    

After following these steps, you can run git difftool and git mergetool to open SourceGear DiffMerge from the Git Bash prompt.

@mkchandler
Copy link
Author

Thanks @gvdwiele, I will try that out. I'm all about simpler ways to do things :-)

@chadembox
Copy link

For Step 4 - The .gitconfig is located in the User/[UserName]/ root folder

@mkchandler
Copy link
Author

I've updated the gist with the suggestions from @gvdwiele. Thanks!

@camwright
Copy link

As of version 3.3, DiffMerge returns a proper exit code. Therefore, trustExitCode should be set to true.

@john-craft
Copy link

This worked great for me. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment