Live Fast, Code Hard, Die Young

Here’s a little tip for those of you looking for a good diff/merge tool. It works quite well with both TortoiseSVN and Git Extensions and I’m sure it works with other applications as well.

Some of you may have heard of Perforce. It’s a pretty expensive source control system that is used by Google among others. I have never used it myself but I guess it’s ok. What I do know is that they have a great tool called P4Merge for merging and checking file differences. Best of all is that you can use it for free!

This is what a comparison looks like:

P4merge file comparison

Installing

To use P4Merge you need to install the Perforce Visual Client which is available as a free download from the Perforce download page. Make sure you get the right version for your system.

When you install it you can uncheck all the other tools and just install P4Merge:

P4merge installation

TortoiseSVN setup

To use P4Merge with TortoiseSVN you need open the TortoiseSVN settings and configure Diff Viewer and Merge Tool like this:

Diff Viewer:
“C:\Program Files\Perforce\p4merge.exe”  %base %mine

Merge Tool:
“C:\Program Files\Perforce\p4merge.exe” %base %theirs %mine %merged

Here’s how it looks for the Merge Tool setting:

TortoiseSVN settings

Git Extensions

It’s pretty easy to configure Git Extensions to use P4Merge. All you have to do is to open up the settings and choose “p4merge” in the Mergetool dropdown. The correct paths should be filled in automatically for you.

Git settings

That’s it – now you can enjoy a pretty nice tool for free!

About these ads

Comments on: "Using a cool merge tool with SVN or GIT" (7)

  1. That’s a good one, even one year later! Thanks a lot!

  2. Thanks! I like it too :)

    • I’m newer. It tried to looking some merge tools. I think It’s a good tools but how can I use it from command line?

  3. I tried to use it with git extentions and the result is very frustrating – after merge the diff tool shows that all the old (base) lines are deleted (-) and the same lines (+ the merge change) are added (+). It’s far not ideal behaviour :(

    • Hmm, that’s weird. It’s working correctly on my machine (Windows). But I think I had a problem with the CRLF setting in Git once that changed all the newlines in the files. Maybe that is what is causing your problems? Try checking the settings for newlines in Git and see if that helps.

  4. [...] or Git with their respective Tortoises, you need to specify the command line in the options dialog: Using a cool merge tool with SVN or GIT tells you how. Team Foundation Server is somewhat more complicated, but still doable: Using P4Merge [...]

  5. Love using P4Merge, thanks for the quick setup info for TortoiseSVN.

    One quick thing though, I had to remove the quotes from the path to the merge tool to get it to work on Win 7 with TortoiseSVN 1.7.7. Might help someone else out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: