Skip to main content
Middle

Interactive Rebase

Middle

Task

Rewrite the last four commits of the main branch using an interactive rebase.

Requirements

  • Select the range of the last four commits.
  • Keep all four commits and their order.
  • Finish the interactive rebase so that the selected part of the history is created anew.

Expected result

main must end with a rewritten chain of four commits that starts after C1. HEAD must stay on main.

What you will learn

After completing the task, you will be able to:

  • select a range for an interactive rebase;
  • understand that rebase creates new copies of commits;
  • control the order and contents of the rewritten history.
Goal
localC0C1C2C2'C3C3'C4C4'C5C5'HEAD main
Git trainer0 commands
terminal
localC0C1C2C3C4C5HEAD main