Scenario library
Start here
Each scenario is a script of commands, not a snapshot — it replays when you open it, so what you see cannot disagree with what the commands actually do. Every one stops just before the interesting command and names it.
A feature branch left behind main
feature-behind-mainThe commonest shape. After the rebase, watch every feature commit change its hash — not because the content changed, but because the parent did, and the parent is part of the hash.
Then try
Open in the sandboxrebase main— Two feature commits will be written as new objects; the old ones stay on the shelf, faded.A messy history to tidy up
messy-historyThree small commits that ought to be one. Interactive rebase folds them together — producing new objects rather than altering the old ones.
Then try
Open in the sandboxopen the interactive rebase panel— Set the three steps to pick + squash + squash.A branch other people already have
published-branchHere rebase is the wrong tool. Commits other people already hold must not be rewritten — use revert, which adds to the history instead of changing it.
Then try
Open in the sandboxrevert HEAD~1— Compare it with `reset --hard HEAD~2`: one is safe for collaborators, the other is not.An accidental reset --hard
accidental-hard-resetThe situation that causes panic. The commit went nowhere: it is still in the store, still named by the reflog, and one command brings it back.
Then try
Open in the sandboxreset --hard HEAD@{1}— Look at the reflog panel: the “lost” commit is right there, faded but whole.Rebasing a branch you already pushed
force-push-dangerThis branch is already on origin. The rebase rewrites its commits, so the next push is rejected — and forcing it leaves the old commit on origin named by nothing. A colleague who already fetched still has it; anyone cloning today never will.
Then try
Open in the sandboxpush origin main— It will be rejected, and the message names which commit would be stranded. Compare with `push origin main --force`, then look at the origin panel.A rebase that conflicts
conflicting-rebaseTwo branches changed the same line. The rebase stops part-way without moving a ref or writing an object — and your resolution is what decides the resulting commit hash.
Then try
Open in the sandboxrebase main— Resolve it in the working-tree panel, `add konfig.txt`, then `rebase --continue`.