P4Merge description, Download page
Open-source, Python-based visual diff and merge tool for comparing files and folders. The P4merge software is used to resolve the Git conflicts like comparing the files, branching and merging the files. P4merge is a visual tool for diffing and merging files and it allows us to view the difference between files across time and across code lines. P4Merge is an excellent, free diff and merge tool.
To add p4merge as visual merge tool, run the following commands in your console. You can also edit your gitconfig file directly. $ git config -global diff.tool p4merge $ git config -global difftool.p4merge.path 'C:Program FilesPerforcep4merge.exe' To setup p4merge as visual diff tool, run the next commands in your console. P4Merge is a visual diff tool that displays the differences between file versions and helps you to resolve conflicts and merge competing versions into one. This chapter includes the following topics.
P4Merge is a 3-way merge tool which comes with the Perforce VCS. To get it you should download 'The Perforce Visual Client'. In OS X case you get p4merge and p4v applications, where you need only the first. Install it in Applications and then add to your ~/.hgrc:
Adjust priority based on your other merge tools (or just leave it if you have no other merge tools) and path if you're not on OS X.
Previously, this page contained the sentence 'It is quite powerful so on OS X (where KDiff3 requires running X11) is likely the best available tool (TODO: compare with DiffMerge).' But KDiff3 does not need X11 and has not for years (given that the QT library has a native Aqua version).
I am still trying P4Merge, but I can say that KDiff3 is very good, open source, character-level diff capable, and my current favourite.
Integrating Perforce’s p4merge with Visual Studio can be a bit tricky, but it doesn’t have to be! Using a couple of pre-written batch files and Visual Studio configurations, you’ll be up-and-running in no time.

Step 1: Copy the following batch files to your c:Program FilesPerforce directory.
- p4diff.bat is for diffing files
- p4merge.bat is for merging files
Step 2: In Visual Studio, navigate to the Configure User Tools dialog.
- Launch Visual Studio.
- Go to Tools > Options… > Source Control > Visual Studio Team Foundation Server.
- Click on Configure User Tools.
Step 3: Click Add.
- You’ll need to do this Add step twice.
- …once to configure p4merge for file compare.
- …and a second time to configure p4merge for file merge.
Step 4: Configure Visual Studio to use p4diff.bat for file compare.
P4merge Download
- In the Configure Tool dialog, enter the following details.
- Extension: .*
- Operation: Compare
- Command: C:Program FilesPerforcep4diff.bat
- Arguments: %1 %2 “x” “x” “x” %6 %7
Step 5: Configure Visual Studio to use p4merge.bat for file merging.
- In the Configure Tool dialog, enter the following details.
- Extension: .*
- Operation: Merge
- Command: C:Program FilesPerforcep4merge.bat
- Arguments: %1 %2 %3 %4 “x” %6 %7 %8 %9
Summary
After saving all your changes, you’re all set.

The next time you do a file compare or file merge operation in Visual Studio, p4merge will be launched.
The file merge operation uses 3-way merge. The left-most pane is the file on the server, the middle pane is the version you had before you made any modifications and the right-most pane is your modified version of the file. The bottom pane is the merged result of the 3-way merge.
P4merge Ubuntu
References
