Skip to content

Instantly share code, notes, and snippets.

@tomdwp
Forked from samsalisbury/.gitconfig
Last active October 14, 2021 05:33
Show Gist options
  • Save tomdwp/5b439e90c435c1e875baeef324d3e789 to your computer and use it in GitHub Desktop.
Save tomdwp/5b439e90c435c1e875baeef324d3e789 to your computer and use it in GitHub Desktop.
Git diff and merge with p4merge (macOS)
[merge]
keepBackup = false
tool = p4merge
[mergetool "p4merge"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$PWD/$BASE\"" "\"$PWD/$REMOTE\"" "\"$PWD/$LOCAL\"" "\"$PWD/$MERGED\""
keepTemporaries = false
trustExitCode = false
keepBackup = false
[diff]
tool = p4merge
[difftool "p4merge"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$LOCAL\"" "\"$REMOTE\""
@tomdwp
Copy link
Author

tomdwp commented Feb 7, 2018

  1. Install p4merge
    -- either from perforce.com
    -- or if you have homebrew, install it with: brew cask install p4merge
  2. copy and paste the above snippet into your ~/.gitconfig file (at the bottom)
    -- if you don't think you have that file, run ls -al ~ to verify
    -- if you don't, then run touch ~/.gitconfig
  3. Then you can do git mergetool and git difftool to use p4merge
  4. Note that git diff will still just use the default inline diff viewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment