Overview

Besides using PhpStorm as an Integrated Development Environment,
you can use it as a command line tool for comparing and merging files.

PhpStorm executable is platform-dependent:

Windows: WebIde XX\bin\phpstorm.exe
or WebIde XX\bin\phpstorm.bat

UNIX: WebIde XX/bin/phpstorm.sh

OS X: /Applications/WebIde XX.app/Contents/MacOS/phpstorm

To add the launcher to your path, add its containing directory
/Applications/PhpStorm.app/Contents/MacOS.

However, for OS X and UNIX, one should create a wrapper script, since this helps avoid some
drawbacks related to the usage of PhpStorm launcher.

Enabling invocation of PhpStorm operations from the command line

For OS X and UNIX platforms, we recommend creating the wrapper script, or the command
line launcher to integrate PhpStorm with your shell. Then, you need to ensure that the created launcher
script is within the search path of your shell.

On Windows, we recommend to add the path to PhpStorm to the environment variable Path.
Everything is done outside of PhpStorm, with the PhpStorm executable.

Note that if you have specified location of the PhpStorm executable as a Path environment
variable, the command will work no matter which directory you are currently in.

To enable invoking PhpStorm operations from the command line, follow these steps

On OS X or UNIX:

Make sure PhpStorm is running.

On the main menu, choose Tools | Create Command-line Launcher. The dialog
box Create Launcher Script opens, with the suggested path and name of the launcher
script. You can accept default, or specify your own path.

Make notice of it, as you'll need it later.

Outside of PhpStorm, add the path and name of the launcher script to your path.

On Windows:

Specify the location of the PhpStorm executable in the Path system environment variable.
In this case, you will be able to invoke the PhpStorm executable and other PhpStorm commands from
any directory.

Merging files using PhpStorm as a command line tool

Most often you need to merge three versions of the same file: your local version,
the version in the repository or in the upstream, and the base revision, which is the origin for the two
diverged versions.