Skip to content

Instantly share code, notes, and snippets.

@tony4d
Created August 24, 2012 19:00
Show Gist options
  • Save tony4d/3454372 to your computer and use it in GitHub Desktop.
Save tony4d/3454372 to your computer and use it in GitHub Desktop.

Revisions

  1. Tony Ford revised this gist Aug 27, 2012. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion p4merge4git.md
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,16 @@ Setup p4merge as a visual diff tool

    $ git config --global diff.tool p4mergetool
    $ git config --global difftool.p4mergetool.cmd \
    "/Applications/p4merge.app/Contents/Resources/launchp4merge \$LOCAL \$REMOTE"
    "/Applications/p4merge.app/Contents/Resources/launchp4merge \$LOCAL \$REMOTE"

    Using p4merge to resolve conflicts
    ----------------------

    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.
  2. Tony Ford revised this gist Aug 27, 2012. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions p4merge4git.md
    Original file line number Diff line number Diff line change
    @@ -8,15 +8,15 @@ Download and install p4merge
    Setup p4merge as a visual mergetool
    ----------------------

    $ git config --global merge.tool p4merge
    $ git config --global mergetool.p4merge.cmd \
    $ 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.p4merge.trustExitCode false
    $ git config --global mergetool.p4mergetool.trustExitCode false
    $ git config --global mergetool.keepBackup false

    Setup p4merge as a visual diff tool
    ----------------------

    $ git config --global diff.tool p4merge
    $ git config --global difftool.p4merge.cmd \
    $ git config --global diff.tool p4mergetool
    $ git config --global difftool.p4mergetool.cmd \
    "/Applications/p4merge.app/Contents/Resources/launchp4merge \$LOCAL \$REMOTE"
  3. Tony Ford created this gist Aug 24, 2012.
    22 changes: 22 additions & 0 deletions p4merge4git.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    Download and install p4merge
    ---------------

    * 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


    Setup p4merge as a visual mergetool
    ----------------------

    $ git config --global merge.tool p4merge
    $ git config --global mergetool.p4merge.cmd \
    "/Applications/p4merge.app/Contents/Resources/launchp4merge \$PWD/\$BASE \$PWD/\$REMOTE \$PWD/\$LOCAL \$PWD/\$MERGED"
    $ git config --global mergetool.p4merge.trustExitCode false
    $ git config --global mergetool.keepBackup false

    Setup p4merge as a visual diff tool
    ----------------------

    $ git config --global diff.tool p4merge
    $ git config --global difftool.p4merge.cmd \
    "/Applications/p4merge.app/Contents/Resources/launchp4merge \$LOCAL \$REMOTE"