DiffMerge

Recently I had to do a bit of git conflict management when merging several branches of supercollider’s repository. I’ve found that FileMerge, the built in tool of OSX just didn’t cut it. I discovered the DiffMerge graphical merge tool which is really incredible and it’s free. To use it with git just download it from the website and install and then do:

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\" \"\$BASE\" \"\$REMOTE\""
git config --global mergetool.diffmerge.trustexitcode false

Then when you merge and get conflicts you can do:

git mergetool -t diffmerge

It will ask you to hit enter for each conflict, then a window with 3 panes comes up. You use the center pane to edit code, but you can select code from the left (the branch where are you are merging to) or from the right (the branch you’re merging from). The center pane contains the newest commit which is common to both branches. While editing code it continuously display the differences to the right and left pane, which is great. When you are done, just hit save and close the application, which will drop back in the bash with git running.

and you can also do a visual diff with

git difftool -t diffmerge master~1 myfile.sc

Leave a comment