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

# diff the local file.m against the version in some-feature-branch
git difftool some-feature-branch file.m

# 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.

Here is a more complete tutorial on merging in DiffMerge.

Published by Abou Kone

I am a front end architect with 10+ years of experience in web development. The best part of the process for me is converting ideas into code and solving the technical problems that come along. Alongside providing technical leadership and architectural support to projects spanning multiple industries, I am also experienced in leading discussions with designers, developers, and business stakeholders helping to guide teams in turning complex business workflows or data into easy-to-use web and mobile interfaces. I believe in delivering high quality products and am constantly looking into improving the process and tools use to achieve this goal.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: