WebStorm 2018.3 Help

Managing Files under Version Control

Add files to VCS

  1. Open the Version Control tool window (Alt+9) and switch to the Local Changes tab.

  2. Put any files in the Unversioned Files changelist under version control by pressing Ctrl+Alt+A or selecting Add to VCS from the context menu. You can either add the entire changelist, or select separate files.

If you have enabled VCS integration for your project, WebStorm suggests to add each newly created file under version control (you can change this behavior in the Settings/Preferences dialog (Ctrl+Alt+S) under Version Control | Confirmation). If you want certain files to always remain unversioned, you can configure your VCS to ignore them.

All the settings files in the .idea directory should be put under version control except workspace.xml, which stores your local preferences. The workspace.xml file should be marked as ignored by VCS.

Check project files status

WebStorm allows you to check the status of your local working copy compared to the repository version of the project. It lets you see which files have been modified, which new files have been added to the VCS, and which files are not being tracked by Git.

Open the Version Control tool window (Alt+9) and switch to the Local Changes tab:

Files with various statuses in the Version Control tool window

  • The Default changelist shows all files that have been modified since you last synchronized with the remote repository (highlighted in blue), and all new files that have been added to the VCS but have not been committed yet (highlighted in green).

  • The Unversioned Files changelist shows all files that have been added to your project, but that are not being tracked by Git.

You can perform deployment tasks, such as uploading files and folders or comparing them with deployed versions, directly from the Local Changes tab of the Version Control tool window. To do this, right-click an item and select Deployment from the context menu. Then choose the desired action from the submenu.

Track changes to a file in the editor

You can also track changes to a file as you modify it in the editor. All changes are highlighted with change markers that appear in the left gutter next to the modified lines, and show the type of changes introduced since you last synchronized with the repository. When you commit changes to the repository, change markers disappear.

The changes you introduce to the text are color-coded:

  • lineAddedMarker line added.

  • lineChangededMarker line changed.

When you delete a line, the following marker appears in the left gutter: deleted line marker.

You can manage changes using a toolbar that appears when you hover the mouse cursor over a change marker and then click it. The toolbar is displayed together with a frame showing the previous contents of the modified line:

ws changeMarkerToolbar

You can rollback changes by clicking icons actions rollback svg (note that all changes to the file since its last revision will be reverted, not just the current line), and explore the differences between the current and the repository version of the current line by clicking icons actions diff svg.

Delete files from the repository

If you delete a file that is under version control, it still exists in the repository until you've committed the changes. The deleted file is placed to the active changelist, and is highlighted with grey.

  1. Select a file in the Project tool window, and press Delete, or choose Delete from the context menu.

  2. In the dialog that opens, you can choose whether you want to delete this file without searching for usages, or to perform safe delete to make sure that you are deleting an unused file by checking the Safe delete option.

    If any usages have been found, the Usages Detected dialog will popup listing them. You can view these usages and remove references to this file before deleting it.

  3. Commit the changes to the repository.

Last modified: 12 December 2018

See Also