Outcome. Clean up a branch with interactive rebase, keep a reference to its old state, and use `git range-diff` to prove the rewrite changed history but not code.
Before you start: Interactive rebase · Resolve and verify a merge conflict
The duration is an estimate of engaged work, not a timer — nothing here waits. Steps marked "Check" and "Practice" are verified in the browser; "Read" and "Lab" steps are yours to confirm.
Read through "Verifying". The verification section is the habit this session builds.
- Predict
Predict: which line do you mark?
≈ 1 min✓ doneFrom the todo list rules.
Do the lab. Before the rebase, create the backup reference it tells you to — the next step depends on it.
Read from "The comparison" to the end, then run `git range-diff` between your backup and the cleaned branch in the lab repository. The article has a deliberate accidental change to find.
Includes the `--force-with-lease` question — the last step of any rewrite.
Completes when the knowledge check on that page has been attempted.
Session complete
Next: Lab: Recover from a force push — You have just learned to rewrite safely; this lab is what happens when someone does not, and how to repair it.
Keep building your Git skills. Get one practical technique, one workflow, and one security lesson each week. Modern Git Weekly is not taking subscriptions yet — read thesample issue, or follow new lessons by RSS.
When you are done: Lab: Recover from a force push. You have just learned to rewrite safely; this lab is what happens when someone does not, and how to repair it.
How did this go?
Unexpected output. Compare your output with the expected block line by line; the first differing line is usually the cause. Then check the version-sensitive notes.
Missing prerequisite. Most "stuck" moments here come from one earlier concept. The prerequisites list names it; the learning path puts it in order.
Unclear explanation. Read the explanation section, then the mental model, then retry the step — the command usually makes sense once the model is in place.
Instructions did not match my environment. Check `git --version` and your shell (Git Bash vs PowerShell vs zsh). Platform notes on the page name the differences that matter; the verification step confirms you are back to a known state.
Good. The next step is to do it without the page open — or move to the recommended next activity below.
All help on this page: Git troubleshooting decision tree · Find the lesson that comes before this one · How Git works — the model behind the commands · Recover a lost commit (lab)