Using PHPStorm to Resolve Merge Conflicts Without Using PHPStorm
Posted on 25/07/2019Most people at my workplace use PHPStorm and the business provide us all with a license. I prefer to use Visual Studio Code because it starts up faster, has a less cluttered user interface, and has a better plugin for Vim keybindings. One thing that I really love about PHPStorm, however, is its git merge conflict resolving tool. I can't find any other visual merge tool that so clearly communicates the five actions I might want: pick the left, pick the right, pick both, pick neither, or do something else.
Today I learned that it is possible to use this feature of PHPStorm in isolation.
The first step is to create a command line launcher for PHPStorm. From the PHPStorm menu bar, select "Tools", "Create command line launcher...". This will start a quick wizard to create a CLI launcher. (I'll assume the command is called phpstorm
for this post.)
Then create and select the mergetool in your ~/.gitconfig
:
[merge]
tool = phpstorm
[mergetool "phpstorm"]
cmd = phpstorm merge $LOCAL $REMOTE $BASE $MERGED
Now when you run git mergetool
it will launch PHPStorm's merge tool.