- Download the perforce visual tool suite from here: http://www.perforce.com/perforce/downloads/index.html
- Copy only the p4merge.app file into your /Applications/ directory
$ git config --global merge.tool p4mergetool
$ git config --global mergetool.p4mergetool.cmd \
"/Applications/p4merge.app/Contents/Resources/launchp4merge \$PWD/\$BASE \$PWD/\$REMOTE \$PWD/\$LOCAL \$PWD/\$MERGED"
$ git config --global mergetool.p4mergetool.trustExitCode false
$ git config --global mergetool.keepBackup false
$ git config --global diff.tool p4mergetool
$ git config --global difftool.p4mergetool.cmd \
"/Applications/p4merge.app/Contents/Resources/launchp4merge \$LOCAL \$REMOTE"
When you run into a conflict when merging simply run:
$ git mergetool
- You will be prompted to run "p4mergetool", hit enter and the visual merge editor will launch.
- Using the merge tool you can resolve the conflict and then save the file.
- After you exit the merge tool take a look back at your terminal. You will be asked if the merge was successful, choose yes if all is well or no if you need to start over.
- This prompting is happening because the "trustExitCode" option is turned off. Personally I always like to be asked, but you can have git just trust the exit code from the merge tool.
Hey, guys. I would like to share my working p4merge(2018.2-1666551) setup on macOS Mojave from both https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration and https://community.perforce.com/s/article/2848
$ brew cask install p4merge
$ sudo vim /usr/local/bin/extMerge
and add below lines:from preforce, the
/Applications/p4merge.app/Contents/Resources/launchp4merge
is not working on me. However, above 'none-shim' method can bring up p4merge windows app. So weird.$ sudo vim /usr/local/bin/extDiff
and add below lines:$ sudo chmod +x /usr/local/bin/extMerge
and$ sudo chmod +x /usr/local/bin/extDiff
my
~/.gitconfig
That's it. I hope these works on your machine.