I’ve been using p4merge as my mergetool for a while now. Yet, every time I need to configure it, I seem to be doing google searches with lots of different “ways” to do so. This is a handy lookup for the future :)

P4merge is now natively supported by Git (as of March, 2014). The latest version available from the p4merge download site automatically adds the binary path to your environment’s PATH. The easiest way to check this is to simply type p4merge from a command prompt to see if you get the following:


If not, you’ll need to add the p4merge binary path (e.g. D:\Program Files\Perforce) to your PATH.

[Note: It’s not entirely necessary for this to be in PATH, you can provide the full path in your Git config file, however having it in PATH makes things simpler.]

With the PATH set up, enter the following:

git config --global merge.tool p4merge
git config --global diff.tool p4merge
git config --global mergetool.prompt false
git config --global mergetool.keepBackup false
git config --global mergetool.keepTemporaries false

Since p4merge is natively supported, we no longer have to create separate .sh scripts, or pass in numerous parameters to p4merge.exe. The relevant entries in the git config file should look like:

    tool = p4merge
    tool = p4merge
    keepBackup = false
    prompt = false
    keepTemporaries = false