Scenarios · Git · GS2.1 · 8 min · L1

reset --hard ate my commits

One command to tidy up. Three commits gone.

✓ Validated on Git 2.43.0 · Run 1 · 2026-11-21Preview

The story

A good afternoon on the Showdown: you renamed the app, added tea as a vote option and bumped the version to 1.1.0. Three commits, not pushed. Then you read a tip online about "cleaning up" and type git reset --hard HEAD~3. git log ends at Lakshmi's Dockerfile commit. Your afternoon is gone, and the demo is tomorrow morning.

1 · Predict first

Are the three commits deleted?
Where can you find their ids?

Where you will meet this at work

  • The same rescue works after a bad rebase, a wrong git commit --amend or a botched merge: find the last good HEAD@{n} and reset to it.
  • The reflog is local. It cannot rescue a commit that was only on a teammate's machine, and it does not hold uncommitted work.
  • Reflog entries expire: after 90 days by default, and after 30 days for commits no branch holds. Rescue lost work the same week.

Keep going