Archive for the ‘development’ Category

Using Perforce merge tool (p4merge) with git on Cygwin

December 17, 2010

This guide will show you how to setup the Perforce merge tool (p4merge) as your default git mergetool on Cygwin.

  1. Download the Perforce client (p4v) from here. (Go to Clients > Visual Merge Tool, and download the appropriate installer for your machine)
  2. Perform the installation, making sure that you only check the merge tool component and cross out all other components
  3. (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”

  4. Add the following lines to your ~/.gitconfig in Cygwin using your preferred text editor:

    tool = p4merge
    [mergetool “p4merge”]
    path = c:/Program Files/Perforce/p4merge.exe
    trustExitCode = true

    Again, edit the path if you used a non-default Perforce install path.

  5. 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.

2 Different ways of iterating through a hash in Perl with different pros/cons

November 28, 2009