WebStorm 2021.2 Help

Enable version control启用版本控制

WebStorm supports version control integration at two levels:WebStorm支持两个级别的版本控制集成:

  • At the IDE level, VCS integration is provided through a set of bundled plugins enabled by default.在IDE级别,VCS集成是通过一组默认启用的捆绑插件提供的。

  • At the project level, VCS integration is enabled by associating project folders with one or several version control systems.在项目级别,VCS集成是通过将项目文件夹与一个或多个版本控制系统关联来实现的。

Associate a project root with a version control system将项目根目录与版本控制系统关联

WebStorm allows you to quickly enable your project's integration with a version control system, and associate it with the project root. WebStorm允许您快速启用项目与版本控制系统的集成,并将其与项目根目录相关联。For instructions on how to associate separate project directories with different version control systems, refer to Associate a directory with a version control system.有关如何将单独的项目目录与不同版本控制系统关联的说明,请参阅将目录与版本控制系统关联

  1. >Choose Enable Version Control Integration from the VCS Operations Popup Alt+` or from the main VCS menu.>从VCS操作弹出窗口Alt+`VCS主菜单中选择启用版本控制集成

  2. In the Enable Version Control Integration dialog that opens, select a version control system from the list that you want to associate with your project folder.在打开的“启用版本控制集成”对话框中,从列表中选择要与项目文件夹关联的版本控制系统。

  3. After VCS integration is enabled, WebStorm will ask you whether you want to share project settings files via VCS. 启用VCS集成后,WebStorm将询问您是否希望通过VCS共享项目设置文件。You can choose Always Add to synchronize project settings with other repository users who work with WebStorm.您可以选择“始终添加”以与使用WebStorm的其他存储库用户同步项目设置。

    Notification prompting to select how to treat configuration files

    Note, that this only applicable to Git and Mercurial.注意,这只适用于Git和Mercurial。

Associate a directory with a version control system将目录与版本控制系统关联

WebStorm supports a directory-based versioning model, which means that each project directory can be associated with a different version control system.WebStorm支持基于目录的版本控制模型,这意味着每个项目目录都可以与不同的版本控制系统相关联。

  1. Press Ctrl+Alt+S to open IDE settings and select Version Control.Ctrl+Alt+S打开IDE设置并选择版本控制
  2. The Version Control page shows a list of project directories and version control systems associated with them (if no directories have been added, the list only contains the project root).版本控制页面显示项目目录和与其关联的版本控制系统的列表(如果未添加目录,则列表仅包含项目根目录)。

  3. Click the Add button Icons welcome create new project on the right.单击右侧的“添加”按钮Icons welcome create new project

  4. In the Add VCS Directory Mapping dialog that opens, select the Directory option. 在打开的添加VCS目录映射对话框中,选择目录选项。Type the path to the directory that you want to associate with a version control system, or click the Browse button the Browse button and select the directory in the dialog that opens.键入要与版本控制系统关联的目录的路径,或单击“浏览”按钮the Browse button并在打开的对话框中选择目录。

  5. From the VCS list, select the version control system that will be used to control the files in this directory. VCS列表中,选择将用于控制此目录中文件的版本控制系统。Note that this list only contains the version control systems for which the corresponding plugins are currently enabled.请注意,此列表仅包含当前已启用相应插件的版本控制系统。

  6. Optionally, click the Configure VCS button that allows you to specify the settings for the selected version control system. (可选)单击“配置VCS”按钮,该按钮允许您指定所选版本控制系统的设置。The same settings are also available under the Version Control settings node.在“版本控制设置”节点下也可以使用相同的设置。

  7. Click OK to save the mapping and return to the Version Control page.单击“确定”保存映射并返回到版本控制页面。

Manage unregistered directories管理未注册的目录

For projects with Git or Mercurial integration enabled, WebStorm scans project directories to check if there are Git/Mercurial repositories that are not controlled by the IDE. 对于启用Git或Mercurial集成的项目,WebStorm会扫描项目目录,以检查是否存在不受IDE控制的Git/Mercurial存储库。If such repositories are detected, WebStorm displays a notification.如果检测到此类存储库,WebStorm将显示一个通知。

To add an unregistered root, click the Add roots link in the notification. 要添加未注册的根,请单击通知中的“添加根”链接。Alternatively, open the Version Control settings page, select the unregistered root you want to add (they are marked grey) and follow the procedure Associate a directory with a version control system.或者,打开版本控制设置页面,选择要添加的未注册根目录(它们标记为灰色),然后按照将目录与版本控制系统关联的过程进行操作。

If you do not want to be notified about these roots again, click the Ignore link in the notification. 如果不希望再次收到有关这些根的通知,请单击通知中的“忽略”链接。Note that if new unregistered repositories are added to the project, WebStorm will notify you about them.请注意,如果向项目中添加了新的未注册存储库,WebStorm将通知您。

Change VCS associations改变VCS关联

  1. Press Ctrl+Alt+S to open IDE settings and select Version Control.Ctrl+Alt+S打开IDE设置并选择“版本控制”。
  2. The Version Control page shows a list of project directories and version control systems associated with them (if no directories have been added, the list only contains the project root).版本控制页面显示项目目录和与其关联的版本控制系统的列表(如果未添加目录,则列表仅包含项目根目录)。

  3. Locate the row that corresponds to the directory which you want to put under another version control system.找到与要置于其他版本控制系统下的目录对应的行。

  4. Click the VCS column. 单击VCS列。From the list that appears, select a new version control system.从出现的列表中,选择新版本控制系统。

  5. Click OK to save the mapping and return to the Version Control page.单击“确定”保存映射并返回到版本控制页面。

Last modified: 08 March 2021