GUI Merge Tool for Git on Windows

So Git doesn’t come with a GUI based merge tool out of the box, which is fine. It’s rather easy to configure Git to use a visual 3-way diff tool.  Here’s some tips on how to setup a GUI merge tool for Git on Windows.

Which one to choose?

Well, that’s a personal choice. Popular ones for Windows seems to be either kdiff3 or P4V visual client.

Here, I will go through the steps to setup the P4Merge: Visual Merge Tool.

First, download the client from Perforce download page.

Start the setup and select only the “Visual Merge Tool” feature:

Select the Visual Merge Tool feature
Select the Visual Merge Tool feature

After the installation has finished, you will need to configure Git to use it. Open a Git bash and type in these two commands;

git config –global merge.tool p4merge
git config –global mergetool.p4merge.cmd ‘”c:\Program Files\Perforce\p4merge.exe” “$BASE” “$LOCAL” “$REMOTE” “$MERGED”‘

That should do it. You can now do visual merging using:

git mergetool

You can also do visual diffs using:

git difftool

 

Leave a Reply

Your email address will not be published.