Features PhpStorm WebStorm

Version Control Systems Support: Basic Concepts

Modern web development workflow can hardly be effective without a Version Control System (VCS) managing all your source code. It’s absolutely essential for team development or when your project grows large. VCS takes care of all your source code management, tracking changes made by developers and letting you: revert files to the previous revision; review code before applying changes and distributing it among the whole team; correct mistakes; develop in different branches; and do lots of other useful things.

PhpStorm (and other IDEs based on the IntelliJ Platform) provides integration with several Version Control Systems, including Git, Subversion, Mercurial and others. Integration includes both support for features specific for each VCS as well as a unified interface and management for common VCS tasks.

In this post we review the basics of working with VCS directly from the IDE.

This functionality is available in IntelliJ Idea, PhpStorm, WebStorm, PyCharm, RubyMine, AppCode.

A version control system is assigned to a project directory and/or additional directories that are part of or related to the project. In PhpStorm, you can easily clone a project from VCS and start working on it, or you can import your whole current project created locally to VCS.

Unified Version Control Functionality

PhpStorm provides a unified mechanism for working with Version Control Systems. However, some of them have unique features implemented which can simplify and speed up your work with that specific VCS.

For projects with VCS support enabled, the standard VCS actions (commit, update, revert, show differences and show history) are added to the main toolbar.

Most VCS-related functionality can be invoked from the VCS menu:

There are also a few hotkeys you’ll definitely find useful with version control systems. These include:

  • Alt+BackQuote (`) / Ctrl-V to invoke VCS quick popup,
  • Ctrl+K / Cmd-K to Commit project to VCS,
  • Ctrl+T / Cmd-T to Update project from VCS, and
  • Alt+Shift+C to View recent changes.

The following unified features are available for all VCSs:

  • Commit and update file/directory or an entire project,
  • Changelists support,
  • Next, Previous, Rollback, and Show Difference actions are available from the dedicated gutter bar in changed locations,
  • View revision history for file/directory,
  • Configuration of common version control system settings,
  • Advanced Version Control tool window, with multiple dedicated tabs: History, Status, Update Info, etc.

Please keep in mind that terminology differs among version control systems. For example, to share your work with others, you need to send your changes (or commits) to the remote repository. In Git you have to commit and then push while in Subversion it is enough to commit.


A changelist is a set of changes in files that represents a change in the source code. The changes specified in a changelist are not stored in the repository until committed (pushed). Any changes made to the source files are automatically included in the active changelist. Initially, the Default changelist is active, but you can make any other changelist active.

In addition to the Default changelist, you can create new changelists, delete existing ones (except for the Default changelist), and move files between different changelists.

All modified, deleted, unversioned and other files are managed in the Changes tool window.

From this window you can:

  • Commit or push changelists,
  • Create new changelists,
  • Remove existing changelists and set the default changelists,
  • Revert modified files in changelists,
  • Add the unversioned files and directories to the VCS,
  • Move files between changelists,
  • Show differences on selected files,
  • Refresh the list of VCS changes,
  • Jump to the source code,
  • Shelve (stash) and unshelve (unstash) changes.

For Git a Log Tab is enabled. This tab shows the changes committed in all the branches of the local and remote repositories, or in a specific local or remote branch. You also can see branch graph on the left.

For other VCSs there is the Repository tab which shows the changes committed to the repository under the VCS roots within the current project. The Incoming tab (not available for Git and Mercurial) shows the changes committed to the repository by other team members, and not yet checked out locally. Both tabs display information stored in the history cache.

You can easily check differences between files (local vs repository, file versions in different branches or in different commits) and apply actions (if you are comparing with local file) to get the proper file as a result with all the changes applied.

Shelves, Stashes and Patches

Sometimes you need to urgently switch to a high-priority task, while some other task is not complete enough to be committed. In this case you might want to put some changes aside and continue working on a stable version.

Shelving is temporarily storing not yet committed changes in a dedicated shelf. Unshelving is returning postponed changes from a shelf to a pending changelist. You can shelve and unshelve both separate files and entire changelists or shelves.

For Git, stashing and unstashing actions are supported in addition to shelving and unshelving. These features have much in common; the major difference is in the way patches are generated and applied. Shelve can operate with either individual files or bunch of files, while Stash can only operate with a whole bunch of changed files at once. Here are some more details on the differences between them.

PhpStorm helps you create and apply patches to the source code. A patch is a file in the standard text format that has the *.patch extension and contains a list of differences between the two sets of source files. You can send it to your collaborators for code review or some other purpose, in case you don’t want to commit it directly to the VCS.

In addition to the VCS there is Local History feature tracking all the changes locally. See this post in order to get more information about it.

Using a unified interface for integrated version control systems, you will easily commit, push and perform any other actions in VCS you currently work with right from the IDE. If you don’t use a VCS yet, give it a try. It will keep your source code safe and clean and help your team work more productively.

Develop with pleasure!
– JetBrains Web IDE Team

Comments below can no longer be edited.

17 Responses to Version Control Systems Support: Basic Concepts

  1. Avatar

    Phil says:

    January 22, 2013

    Good that you support VCS, but it is IMHO useless to replicate Git features and to not support (or faulty support) basic features like –amend at the same time.

    I always do (git) VCS operations in the command line, because PhpStorms Git features are too limited to be of any use.

    • Avatar

      Vasily Bezruchkin says:

      January 23, 2013

      Just curious what’s wrong with the amend functionality while commiting your changes? It works fine for us.

      • Avatar

        Konstantin says:

        January 23, 2013

        Sometimes you have nothing to commit but at the same time you still want to call amend.

      • Avatar

        Phil says:

        January 24, 2013

        Simple … it does not restore the (old) commit massage.

  2. Avatar

    Vlad says:

    January 22, 2013

    Its a great article, however there is still much work to do on VCS support, especially git. I have to say that the overlap of several phpstorm features and git features like shelve vs stash sometimes makes the understanding of the VCS part of the IDE kind of tricky.

    Also, some simple git operations were unavailable in the IDE, which caused me to dive into command line, and this would happen so often, that i just got used to work with the git command line.

    The only features i use from VCS currently is viewing diffs and merging. This is where i like the IDE better.

    Also submodules support … nevermind 🙂

  3. Avatar

    Timur says:

    January 22, 2013

    Also git push -f would be nice to add as well.

  4. Avatar

    Jason Sylvestre says:

    January 23, 2013

    I use Git Extensions, to be honest, this looks like a step backwards.

  5. Avatar

    Gregorio Ramirez says:

    January 23, 2013

    These tools are very handy, I use the diff, push a lot. I also like how the editor highlights new & modified lines. The only valid complaint is the one suggesting more support for extra/missing features.

  6. Avatar

    Rafi B. says:

    January 25, 2013

    Still trying to figure out how to manage Git submodules with PhpStorm. Let’s say I have a Git repo with several submodules in it, how would I commit a change on an inner submodule ?

  7. Avatar

    Danko Alexeyev says:

    February 4, 2013

    I for one like the support for Mercurial (maybe because I don’t usually require “basic” functionality like amend, rebase, change laws of physics, time travel, you know, usual stuff) and it’s really great for simple workflow of pull – diff – commit – push. Except one tiny thing: somehow, while having zero problems with multiple repos anywhere else, after pressing “Commit and Push” the IDE suddenly forgets which repo I’ve just commited to and offers me to choose what to push myself. That’s a bit annoying.

  8. Avatar

    Dmitry Dulepov says:

    February 6, 2013

    I read carefully but I still do not understand: what is the point of changelists? Why would I want to have multiple changelists? Never used them and after reading I do not see why would I want to use them.

    Any hints?

    • Avatar

      Phil says:

      February 6, 2013

      My guess: Changelists are for people suffering from “Attention deficit-hyperactivity disorder” which are unable to complete a single task at a time.

      After all, I would prefer support for git stash and other advanced features of modern VCS as this seems to be more useful.

  9. Avatar

    Jason F says:

    February 13, 2013

    Those of you who complain about the VCS tools — I personally see it as a nice way to enhance my ability to view diffs. The diff feature is really nice — and useful.

    I think the convenience features for making commits, etc are nice, but I actually prefer to just use GitG (linux) to review my commits & my own custom alias commands / grep, etc (i.e. command line) for my of my GIT handling.

    I may start trying to use the PHPStorm commit feature is nice, but I (sadly) prefer the very simple GitG view…

    I don’t think any tool can completely replace command-line GIT — not if you’re an advanced user.

    • Avatar

      Jason F says:

      February 13, 2013

      Moderator — can you please remove this sentence from my first comment:
      I may start trying to use the PHPStorm commit feature is nice, but I (sadly) prefer the very simple GitG view…
      & replace it with:
      I (sadly) prefer the very simple GitG view vs PHPstorms commit feature / view.

Discover more