PhpStorm 8.0.0 Web Help

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

In this topic:

To enable invoking PhpStorm operations from the command line, do one of the following
  • Using the command line commands, for example, cd to change the directory, switch to the directory where the PhpStorm executable file is located (PhpStorm installation directory). The CMD commands, the name of the PhpStorm executable, and its default location depend on the operating system you use. See the lists of CMD commands for Windows, OS X, Linux.
  • 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 command from any directory.
To compare two files using PhpStorm as a diff command line tool
  1. Enable invoking PhpStorm operations from the command line.
  2. Type the following command at the command line prompt:
    <PhpStorm launcher> diff <path to file1> <path to file2> 
                         
    where file1 is your local copy, file2 is the repository version.

    Note

    1. If you have specified the location of the PhpStorm executable as a Path environment variable, the command will work no matter which directory you are currently in. Otherwise, you need to switch to the PhpStorm installation folder first or specify the full path to the executable.
    2. PhpStorm executable is platform-dependent: PhpStorm.exe or %product.bat for Windows and PhpStorm.sh for Linux.

      For OS X, the executable is /Applications/PhpStorm.app/Contents/OS X/webide. To add the launcher to your path, add its containing directory /Applications/PhpStorm.app/Contents/OS X.

To merge 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.

  1. Enable invoking PhpStorm operations from the command line.
  2. Type the following command at the command line prompt:
    <PhpStorm launcher> merge <path to file1> <path to file2> <path to file3> <path to output>
                
    where file1 is your local copy, file2 is the repository version, file3 is the base revision for file1 and file2, and output is the file to save the merge results in (optional).

See Also

Procedures:

Reference:

Web Resources: