Skip to end of metadata
Go to start of metadata

Redirection Notice

This page will redirect to in about 2 seconds.


In this tutorial, we will see how to work with Local History in PhpStorm.

While working on a project, source code constantly changes. When you use a VCS (Version Control System), changes can be committed to a central repository and differences between committed versions can be tracked. But what about changes done between debugging sessions? What about changes that are not committed? There is Undo for those, or Local History.

Local History enables us to compare versions and, if needed, roll changes back to a previous state. Note that unlike version control systems, Local History is intended for personal use. It does not support shared access across team members.

1. Enabling Local History

This is actually not a step to perform: Local History is enabled by default and works with all textual files within project directories. It keeps track of all changes in a project, a directory or package, a file, a class, class members, tags, or selected fragment of text.


For files > 1 MB, Local History will not keep the actual changes but just the fact that something has been changed. Using a VCS and committing files often overcomes this limitation.

2. Showing Local History

Showing Local History for files and folders

To bring up Local History for a file or folder, we can use any of the following routes:

  • Use the VCS | Local History | Show History menu.
  • Use the VCS operations quick list keyboard shortcut, Alt+` (Alt+Backquote) or Control+V on Mac OS X and then select Show History under the Local History header.

This will open a new window displaying local changes. The tree on the left shows a description of the changes. On the right, a diff will be shown between the selected version and the previous version. From the Local History window we can revert changes, copy some piece of code, or create a patch:

Operations such as a file rename are also shown:

Showing local history for selected code

After selecting some text or code in the editor, invoke the Local History | Show Local History for Selection context menu. This will show changes for just the selection:

Viewing recent changes

From the editor, we can use the View | Recent Changes menu or use the keyboard shortcut Alt+Shift+C. This will show a quick list with all the changes made to the file. In this popup, we can revert to previous versions of the file and rollback any changes that were tracked by local history:

3. Labels in Local History

Local History keeps track of changes by default. However, it may make sense to put a descriptive label on a certain change to make it easier later to find a specific change in the Local History window. Labels can be added to files, entire folders, or the complete project.

To add a label, either:

  • Use the Local History | Put label... context menu
  • Use the VCS operations quick list keyboard shortcut, Alt+` (Alt+Backquote) or Control+V on Mac OS X and select the Put label... action.

This will bring up a dialog in which the label name can be given:

The label will be shown in Local History and will help identify specific changes:

  • No labels