Suppose, you have two diverged branches, master and experimental. One day, you decide to integrate changes from one specific commit in experimental to branch_2. With PhpStorm, you can cherry pick between branches right from the Changes tool window.
Unlike the native git cherry-pick action, PhpStorm does not commit the selected changes to the other branch automatically but stores them in a new change list.
Switch to the target branch the
changes will be integrated to.
It is required that your working tree should be clean, that is, there should be no modifications from the HEAD commit.
- Open the Changes tool window and switch to the Log tab.
From the Branch drop-down list on the toolbar, select the source
branch from which you want to integrate the changes.
The Commits area lists all the commits performed in the selected branch. To reduce the number of items in the list, specify the author of the required commit in the User drop-down list.
- From the Commits list, select the required commit. Use the commit information below, if necessary.
- Click the Cherry-pick button on the toolbar. PhpStorm displays a dialog box that informs you that changes are going to be cherry-picked to the current branch. Click Continue to launch cherry picking. When cherry picking is completed, PhpStorm displays the corresponding information message.
- Switch to the Local tab where the cherry picked changes are grouped in a new change list. The name of this change list is the commit message of the commit the changes are cherry picked from.
- Commit the changes from the new change list.
- Managing Branches
- Committing Changes to a Local Git Repository
- Using Git Integration
- Checking in Files
- Version Control with PhpStorm