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.
- Open a project in PHP Storm
- Click Tools » Create Command-line Launcher…
- Edit your ~/.gitconfig file:
PHP12345678910[diff]tool = pstorm[difftool]prompt = false[difftool.pstorm]cmd = /usr/local/bin/pstorm diff "$LOCAL" "$REMOTE"[merge]tool = pstorm[mergetool.pstorm]cmd = /usr/local/bin/pstorm merge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
- Open the project in PHP Storm (see notes below)
- Open iTerm2 (or any other terminal emulator)
git difftoolas you normally would (e.g.,
git difftool .htaccess)
- If you don’t have PHPStorm open when you try to use
git difftoolit 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.
- 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.