This guide will show you how to setup the Perforce merge tool (p4merge) as your default git mergetool on Cygwin.
- Download the Perforce client (p4v) from here. (Go to Clients > Visual Merge Tool, and download the appropriate installer for your machine)
- Perform the installation, making sure that you only check the merge tool component and cross out all other components
- (This step is optional)
Open up cygwin, and create a symlink to p4merge by doing:ln -s /cygdrive/c/Program\ Files/Perforce/p4merge.exe /usr/bin/p4merge
(modify the target path if you installed Perforce in a non-default folder). This way, you can open up p4merge anytime in Cygwin simply by typing “p4merge”
- Add the following lines to your ~/.gitconfig in Cygwin using your preferred text editor:
[merge]
tool = p4merge
[mergetool "p4merge"]
path = c:/Program Files/Perforce/p4merge.exe
trustExitCode = trueAgain, edit the path if you used a non-default Perforce install path.
- Save and exit the file. If you have pending merges in the current git tree and you type git mergetool, voila, your merge will be done using the very user-friendly p4merge.
Advertisement
Tags: cygwin, git, merge, mergetool, p4merge, perforce, windows