PhpStorm 2021.2 Help

Git

The page is available only when the Git plugin is enabled. The plugin is bundled with PhpStorm and activated by default. If the plugin is disabled, enable it on the Installed tab of the Settings/Preferences | Plugins page, as described in Managing plugins.

Use this page to specify the version control settings that will be applied to the directories of your project that are under Git control.

Item

Description

Path to Git executable

In this field, specify the path to the Git executable file. Type the path or click Browse the Browse button and specify the path in the dialog that opens.

PhpStorm supports Git from the Windows Subsystem for Linux 2 (WSL2), which is available in Windows 10 version 2004.

If Git is not installed on Windows, PhpStorm searches for Git in WSL and uses it from there. Also, PhpStorm automatically switches to Git from WSL for projects that are opened when you use the \\wsl$ path.

WSL2 support for Git on Windows

Test

Click this button to verify the path to the Git executable file.

Set this path only for current project

Select this option if you want to use different paths for different projects, and don't want this setting to be applied globally.

Execute branch operations on all roots

This option only becomes available if you have a multirooted project, that is there are several Git repositories within a single project.

Select this option if you want branch operations (such as checkout, merge, and so on.) to be applied synchronously to all repositories within your project.

Enable staging area

Enable this option if you are more used to the concept of staging changes for commit instead of using changelists where modified files are staged automatically.

Using the staging area allows you to easily commit changes to the same file separately (including overlapping changes), and see which changes are already staged without switching focus from the editor. For details, see Use the Git staging area to commit changes.

Commit automatically on cherry-pick

When you cherry pick a specific commit, the Commit Changes dialog is displayed. If the Commit automatically on cherry-pick option is selected, the selected commit is submitted silently on clicking the cherry-pick button the Cherry-Pick button, without displaying the Commit Changes dialog.

Add the 'cherry-picked from <hash>' suffix when picking commits pushed to protected branches

Select this option if you want to keep a reference to the original commit when cherry-picking a commit from a protected branch. By default, no suffix is added when cherry-picking a change.

Warn if CRLF line separators are about to be committed

Select this option to enable smart handling of LF and CRLF line separators. PhpStorm will analyze your configuration, warn you if you are about to commit CRLF into the repository, and suggest changing the core.autocrlf setting to true or input depending on your operating system.

If this option is deselected, you will have to fix issues with line endings manually using the Difference Viewer dialog.

Warn when committing in detached HEAD or during rebase

Select this option if you want PhpStorm to display a warning when a commit is performed from a detached head or on rebase, as this may cause issues and code loss.

Explicitly check for incoming commits on remotes

If this option is enabled, PhpStorm will check if there are pending incoming commits that have not been fetched to your local repository, and will mark such branches in the Branches popup.

Select how you want to PhpStorm to query the remote to check for incoming commits:

  • Auto: PhpStorm will check for updates in the background if HTTP or Git protocol is used to access the remote. If SSH is used, this check will not be performed so that external authentication applications don't popup unexpectedly.

  • Always: PhpStorm will check for updates in the background even if SSH is used to access the remote.

  • Never: PhpStorm will not query the remote for incoming commits, and a warning will be displayed in the Branches popup, allowing you to run the check manually.

Update method

Use this list to choose the strategy to synchronize your local repository with the remote storage. The selected method will be used when the push operation is rejected (if the Auto-updated if push of the current branch was rejected option is enabled), or when you invoke the Update Project operation. The following options are available:

  • Merge: select this option to perform merge during the update. This is equivalent to running git fetch and then git merge, or git pull --no-rebase.

  • Rebase: select this option to perform rebase during the update. This is equivalent to running git fetch and then git rebase, or git pull --rebase (all local commits will be put on top of the updated upstream head).

Clean working tree using

Select how you want uncommitted changes to be treated when you perform a project update:

  • Stash: local changes will be saved to a git stash. This is useful if you need to apply patches with stashed changes outside PhpStorm, as they are generated by Git itself.

  • Shelve: PhpStorm will put local changes to a shelf. Shelving is done by PhpStorm, and patches generated from shelved changes are normally applied inside PhpStorm.

Auto-update if push of the current branch was rejected

Select this checkbox if you want the current branch to be updated automatically if the push operation from the current branch to its tracked branch is rejected.

If this option is deselected, PhpStorm will display the Push Rejected dialog when pushing a branch is rejected because your local repository and the remote storage are not synchronized.

Note the following:

  • If you have never seen the Push Rejected dialog before and you are enabling the checkbox initially, PhpStorm will update the conflicting local branch silently by means of the merge operation.

  • If you have already encountered the Push Rejected dialog and selected the Remember the update method choice... option, PhpStorm saves your last choice rebase or merge and will apply it to update the conflicting local branch silently.

    Accordingly, to change the "remembered" setting, clear the checkbox, access the Push Rejected dialog, select the Auto-update if push ... rejected option, and invoke another update strategy.

Show Push dialog for Commit and Push

Select this option if you want the Push dialog to be displayed after you've clicked Commit and Push in the Commit Changes dialog. Otherwise, your changes will be pushed automatically to the affected repository.

Show Push dialog only when committing to protected branches

Select this option if you only want to show the Push Changes dialog if you are pushing to a protected branch when you've clicked Commit and Push in the Commit Changes dialog. Otherwise, your changes will be pushed automatically to the affected repository.

Protected branches

If you want to disable the ability to force push changes for certain branches, list them here (this is a team-shared parameter that is stored in .idea/vcs.xml).

You can list several branches separated by a semicolon, or supply branch patterns as the input is treated as a list of regular expressions.

Use credential helper

Select this option if you don't want to override credential helpers>credential helpers, which is the default behavior. You will be able to authenticate using a credential helper in the Git login dialog.

Filter Update Project information by paths

If you don't want to get information on all changes to a project in the Update Info tab when you perform an update, you can filter the list by specific paths.

Configure GPG Key

Click to configure GPG Key for signing your commits, or to select an existing key. See Sign commits with GPG keys for details.

Last modified: 26 November 2021