Module lessons (5/5)
Time machine rescue with git reflog
Use Reflog X-Ray and HEAD@{N} offsets to recover commits orphaned by reset or amend.
What you'll learn in this lesson
- Use Reflog X-Ray (
git reflog) to locate commits orphaned byreset --hard,amend, or branch deletion. - Rescue apparently lost commits instantly via
git reset --hard HEAD@{N}or a brand-new safety branch. - Recognize exact boundaries of
git reflog: commits saved vs uncommitted edits never staged/committed.
Overview
Running git reset --hard HEAD~1 right after creating an important commit feels horrifying: git log shrinks and your Stripe integration commit seems to vanish!
Yet commits inside .git/objects are immutable! Moving feat/checkout backward only made that commit unreachable (orphaned) from branches. Git privately logs every local jump of HEAD inside a chronological diary called the Reflog (git reflog):
Sections covered in this lesson
- 1Nothing Committed Disappears Immediately
- 2Trace Orphan Rescue Inside the Matrix Lab
Unlock "Time machine rescue with git reflog" and the full Git & Modern Collaboration curriculum
Use Reflog X-Ray and HEAD@{N} offsets to recover commits orphaned by reset or amend.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Git & Modern Collaboration plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.