Rebasing branches interactively provides you with the possibility to apply commits in the necessary order, squash or edit commits before applying, and skip commits that contain extraneous changes.
Interactive mode is available for rebasing branches entirely or partially on top of the HEAD or to any specific commit.
- Initiate the rebase procedure.
- Select the Interactive check box.
To have PhpStorm try to recreate merges instead of ignoring them, select the Preserve Merges check box.
Git does not support squashing commits when the Preserve merges option in enabled.
- Specify the new base, the range of commits to apply, and the merge strategy.
- Click OK. The Rebasing Commits dialog box opens
displaying a list of all the commits within the specified range in the chronological order. For each commit its hash and comment are shown.
To view which files are affected in a commit, select the commit and click the View button.
- Define the order of processing the commits by selecting the relevant lines and clicking the Move Up and Move Down buttons.
- Use the Action drop-down list to define how each commit should be processed:
- To apply a commit as is, select the Pick option.
- To update a commit before applying, select the Edit option.
- To ignore a commit, select the Skip option.
- To combine a commit with the previous commit, select the Squash option.
After you start rebasing, you will be asked to supply additional information on the squashed commits.
If the affected commits have different authors, the squashed commit will be attributed to the author of the first commit.
- Click the Rebase button. The rebase process starts. View the rebase log in the Version Control tool window, resolve conflicts that arise, and resume rebasing.