Using PHPStorm for Git Diff and Merge tools (Mac)

You love git-difftool, right? Of course! You also love PHP Storm, right? Of course! This easy procedure lets you use PHP Storm as your git-difftool.

  1. Open a project in PHP Storm
  2. Click Tools » Create Command-line Launcher…
  3. Edit your ~/.gitconfig file:
  4. Open the project in PHP Storm (see notes below)
  5. Open iTerm2 (or any other terminal emulator)
  6. Use git difftool as you normally would (e.g., git difftool .htaccess)

Observations

  1. If you don’t have PHPStorm open when you try to use git difftool it doesn’t seem to work. I need to see if I can get it to open non PHP Storm projects, and/or I need to figure out how to switch on-the-fly between vimdiff and PHP Storm as my difftool.
  2. If you have PHP Storm open but the project itself isn’t open, “Annotate” is not available on right-click. Other functionality may be missing too. If you project is already open in PHP Storm you can annotate the diff!

Thank you to JohnAlbin for the configuration snippet above.

Tagged with: , ,
Posted in Development, Tech Tips

Leave a Reply

Your email address will not be published. Required fields are marked *

*