Marketing digital. Making results.

Git Merge/Git Difftool: Compare a file between two different branches

Moving from Subversion to Git can be hard and i ran into an issue trying to resolve conflicts in a file that was different in the two branches I work on. Since I am working on a Mac, with OSX Lion, i found these two articles to be quite useful:

How to setup Git to use Diffmerge to setup DiffMerge as your Git difftool, for Mac OSX you actually need to set the path to DiffMerge like this:

prompt = NO
[difftool "diffmerge"]
cmd = ~/Applications/ “$LOCAL” “$REMOTE” # For DiffMerge

Using DiffMerge as your Git visual merge and diff tool provided some good examples on how to use the command git difftool

# diff the local file.m against the checked-in version
git difftool file.m

  1. diff the local file.m against the version in some-feature-branch

git difftool some-feature-branch file.m

  1. diff the file.m from the Build-54 tag to the Build-55 tag

git difftool Build-54..Build-55 file.m

This helped me resolve my issues, DiffMerge is an impressive tool, especially the three way merge, and I heavily recommend it.