Applying Changes from a Specific Commit to Other Branches (Cherry Picking)
Suppose, you have two diverged branches,
One day, you decide to integrate changes from one specific commit in
With PyCharm, you can cherry pick between branches right from the Changes tool window.
Unlike the native git cherry-pick action, PyCharm does not commit the selected changes to the other branch automatically but stores them in a new change list.
To cherry pick changes between two branches
- Switch to the target branch the changes will be integrated to.
- 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.
- From the Commits list, select the required commit. Use the commit information below, if necessary.
- Click the Cherry-pick button on the toolbar. PyCharm 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, PyCharm 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.