Skip to main content
Senior

Rebasing Multiple Branches

Senior

Task

Arrange the changes of three side branches into one linear chain on top of main. At the start, HEAD is on bugFix.

Steps

  1. Rebase bugFix onto main.
  2. Switch to side and rebase it onto the updated bugFix.
  3. Switch to another and rebase it onto the updated side.

Expected result

The history must become linear in the order main → bugFix → side → another. HEAD must end up on another.

What you will learn

After completing the task, you will be able to:

  • rebase several branches one after another;
  • choose a new base for each next branch;
  • plan the order of rewriting dependent lines of history.
Goal
localC0C1mainC2C2'bugFixC3C3'sideC4C4'HEAD another
Git trainer0 commands
terminal
localC0C1mainC2HEAD bugFixC3sideC4another