Skip to content

Instantly share code, notes, and snippets.

@CiprianSpiridon
Created October 27, 2014 10:06
Show Gist options
  • Save CiprianSpiridon/bd80e805b49ef7513a7e to your computer and use it in GitHub Desktop.
Save CiprianSpiridon/bd80e805b49ef7513a7e to your computer and use it in GitHub Desktop.
How to usePHPStorm/WebStorm as git diff and merge tools
# ~/.gitconfig
# Add this to your global git configuration file
# Change phpstorm to webstorm, if you use that.
# Diff and merge tool changes
# Run `git difftool <directory/file>...` or `git mergetool <directory/file>...`
[merge]
tool = phpstorm
[diff]
tool = phpstorm
[difftool]
; This setting is optional, but prevents an annoying prompt between diffing files.
prompt = false
[difftool "phpstorm"]
; Putting this path here doesn't work. I would love to know why.
; path = /Applications/PHPStorm.app/Contents/MacOS
cmd = webide diff $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE")
trustExitCode = true
[mergetool "phpstorm"]
cmd = webide merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
# Add this to your .profile, .zshrc, .bashrc, etc.
# Add PHPStorm's bin directory to your path.
export PATH="/Applications/PHPStorm.app/Contents/MacOS:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment