Last Updated: April 12, 2020
·
8.756K
· shinn

Set DiffMerge as default merge tool in OS X

I used to use meld in linux to solve the merge conflicts where it has a simple and straight forward interface (Personally prefer the 3-columns-view).

Installing meld on OS X was a pain (Now you can simply brew install meld!) because of some dependencies issues. Therefore I've been looking for some alternative and found DiffMerge, which is similar to meld and with a better-OS-X-UI-feeling.

However git mergetool doesn't support DiffMerge by default, so running these commands in terminal will use DiffMerge as the default git merge tool.

git config --global merge.tool diffmerge

git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE"

git config --global mergetool.diffmerge.trustExitCode true

Update - If you're getting an error saying diffmerge command not found, you might want to try this:

ln -s /Applications/DiffMerge.app/Contents/Resources/diffmerge.sh /usr/local/bin/diffmerge

Also, you might not want git to create backups with .orig extensions after each successful merge. Run this command:

git config --global mergetool.keepBackup false