PhpStorm 9.0.0 Help

Applying Changes from a Specific Commit to Other Branches (Cherry Picking)

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.

To cherry pick changes between two branches

  1. Switch to the target branch that the changes will be integrated to.

    It is required that your working tree is clean, that is, there should be no modifications from the HEAD commit.

  2. Open the Changes tool window and switch to the Log tab.
  3. From the Branch drop-down list on the toolbar, select the source branch containing the changes you want to cherry-pick.

    Note that the Commits pane lists all commits performed in the selected branch. To reduce the number of items in the list, you can filter the commits by the user or date.

  4. Select the required commit. Use the information in the Commit Details area if necessary.
  5. Click the Cherry-pick button cherryPickButton.png on the toolbar. PhpStorm will display the Commit Changes dialog with the automatically generated commit message.
  6. If you want to review the changes or even modify the code before committing it to the target branch, you can do so in the difference viewer available from this dialog.
  7. When done, click Commit to cherry-pick the selected changes.

Note that if you click Cancel in the Commit Changes dialog, a separate changelist will be created with the selected changes that you can see in the Local Changes tab. You can review these changes and commit them later if necessary.

See Also

Last modified: 2 July 2015