Skip to content

Instantly share code, notes, and snippets.

@cmatskas
Created June 3, 2021 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmatskas/0811a6d4ef3d1ec35f92b3edd59eb9ef to your computer and use it in GitHub Desktop.
Save cmatskas/0811a6d4ef3d1ec35f92b3edd59eb9ef to your computer and use it in GitHub Desktop.
Set up p4merge as the default merge and diff tool in Git

Assuming that P4Merge was installed in the default location on Windows, i.e 'C:\Program Files\Perforce\p4merge.exe' then the following commands will configure p4merge as the default tool for both merge and diffs in Git

Set up commands

$ git config --global diff.tool p4merge
$ git config --global difftool.p4merge.path 'C:\Program Files\Perforce\p4merge.exe'
$ git config --global merge.tool p4merge
$ git config --global mergetool.p4merge.path 'C:\Program Files\Perforce\p4merge.exe'

You can launch p4merge from the command line:

git difftool
git mergtool

You can check if the configuration was done correctly by issuing the following command:

git config --global -l 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment