Interactive Rebase

A plain rebase replays your commits exactly as they are. rebase -i lets you rewrite the list first — reorder it, delete from it, or fold commits together.

It opens a plan: every commit about to be replayed, oldest first, each marked pick. Nothing has happened yet. You change the marks, then run it.

drop leaves a commit out. squash folds a commit into the one above it, so two commits become one. Moving a row changes the order they replay in.

In real git this plan is a file that opens in your editor. Here it is the panel below — the buttons issue todo commands, so every edit is something you could type, undo, and see explained.

Exercises

  1. Exercise 1. Three commits are queued, but the middle one was a mistake. Open the plan, drop it, and run the rebase — the other two should survive.
  2. Exercise 2. c2 is a small follow-up to c1 that should never have been its own commit. Squash it into c1 so they land as one.
  3. Exercise 3. The urgent fix (c2) is stuck behind unfinished work. Move it to the front of the plan so it replays first, then run the rebase.