Skip to content

Instantly share code, notes, and snippets.

@ramesaliyev
Forked from smoll/USING-DIFFMERGE.md
Last active November 14, 2020 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramesaliyev/9d93bcc8ec0c0535759be57fc500f89e to your computer and use it in GitHub Desktop.
Save ramesaliyev/9d93bcc8ec0c0535759be57fc500f89e to your computer and use it in GitHub Desktop.
Using DiffMerge as your git mergetool (for Mac OS X / macOS)

Using DiffMerge as your git mergetool (for Mac OS X / macOS)

Reference(s):

Step 1: download and install the DiffMerge OS X Installer

http://www.sourcegear.com/diffmerge/downloads.php - get the installer version, NOT the dmg version

Step 2: configure it

[push]
	default = simple
[user]
	name = Rames Aliyev
	email = ramesaliyev@gmail.com
[mergetool]
	keepBackup = false
[pager]
	branch = false
[diff]
	tool = diffmerge
[difftool "diffmerge"]
	cmd = /Applications/DiffMerge.app/Contents/MacOS/DiffMerge \"$LOCAL\" \"$REMOTE\"
[merge]
	tool = diffmerge
[mergetool "diffmerge"]
	cmd = "/Applications/DiffMerge.app/Contents/MacOS/DiffMerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\""
	trustExitCode = true

or

git config --global diff.tool diffmerge
git config --global difftool.diffmerge.cmd 'diffmerge "$LOCAL" "$REMOTE"'
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd 'diffmerge --merge --result="$MERGED" "$LOCAL" "$(if test -f "$BASE"; then echo "$BASE"; else echo "$LOCAL"; fi)" "$REMOTE"'
git config --global mergetool.diffmerge.trustExitCode true
git config --global mergetool.keepBackup false

Step 3: use it

Any time you encounter a merge conflict, just do git mergetool

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