Outcome. Restore a force-deleted branch to its exact last commit using the reflog, and explain why that works and when it stops working.
Before you start: Git branches: how branching really works
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 "Branches and commits" through "Creating a branch". The sentence that matters: a branch is a name for one commit.
The lesson's own recovery section. Note what `git reflog` lists and what its entries point at.
- Predict
Predict: what does `git branch -D` delete?
≈ 1 min✓ doneAnswer from the pointer model.
The check verifies the branch points at the last commit — not merely that a branch with that name exists.
Scenario: Recover a deleted branch — completes automatically when the simulator's check passes.
The same recovery in `/tmp`, with real reflog output. Mark this step when your `git log --oneline` shows all three commits.
Detached HEAD and recovery, from the lesson the reflog lives in.
Completes when the knowledge check on that page has been attempted.
Session complete
Next: Resolve and verify a merge conflict — Recovery handles the "lost" case; conflicts are the other everyday interruption, and the session is the same length.
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: Resolve and verify a merge conflict. Recovery handles the "lost" case; conflicts are the other everyday interruption, and the session is the same length.
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)