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

  1. 01Lost
  2. 02Reflog
  3. 03Recover
  4. 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.

← All Git labs

Your first machine is
8 seconds away.

Learn by doing on real machines — and give every AI agent one of its own.

Free forever · No credit card · Cancel anytime

Recover a Deleted Branch with the Reflog — Git lab | Kube Labs