Using Perforce merge tool (p4merge) with git on Cygwin
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:
tool = p4merge
path = c:/Program Files/Perforce/p4merge.exe
trustExitCode = true
Again, 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.
Friday, December 17th, 2010, 4:47 am