Recover a Deleted Branch with the Reflog
A hasty clean-up deleted an unpushed branch with two days of work. Find its commits in the reflog, recreate the branch, and publish it before anything else goes wrong.
Project labintermediate~20 minPro
What you'll do
- ✓Explain that deleting a branch deletes a name, not commits
- ✓Find lost commits in the reflog
- ✓Recreate a branch at a specific commit
- ✓Know that reflogs are local and expire
Lab outline
- 01Lost
- 02Reflog
- 03Recover
- 04Publish
Before you start
- Reset modes and ORIG_HEAD (git-22)
Every lab runs on a real machine of your own in the browser — no installs, nothing to clean up — and checks your work automatically as you go.