Hosting Operations
Find a Discarded Commit in Reflog
Someone ran reset during incident work and you need to locate the commit that disappeared from the branch tip.
Command
cd /lab/git-recovery-rollback && git reflog --date=iso --format='%h %gd %gs' -6
What changed
Nothing changes. Git prints recent HEAD movements from the reflog.
Danger
safe
When to use it
Use after an accidental reset, checkout, commit amend, or branch movement.
When not to use it
Do not wait weeks to inspect reflog; entries can expire or be pruned.
Undo or recovery
No undo needed because this command is read-only.
Expected output
Recent reflog entries showing a reset and the discarded incident-note commit.
demo script
Disposable terminal steps
cd /lab/git-recovery-rollback && git reflog --date=iso --format='%h %gd %gs' -6cd /lab/git-recovery-rollback && git show -s --format='%h %s' HEAD@{1}
simulated output
What it looks like
::fixture-ready::
$ cd /lab/git-recovery-rollback && git reflog --date=iso --format='%h %gd %gs' -6
de583c6 HEAD@{2026-06-26 00:27:37 +0000} reset: moving to HEAD~1
7e5872b HEAD@{2026-06-25 10:45:00 +0000} commit: Capture incident rollback note
de583c6 HEAD@{2026-06-25 10:30:00 +0000} commit: Release 2026-06-25 10:30
c15c7c6 HEAD@{2026-06-25 10:00:00 +0000} commit: Release 2026-06-25 10:00
ddb9d51 HEAD@{2026-06-24 17:00:00 +0000} commit (initial): Release 2026-06-24 17:00
::exit-code::0
$ cd /lab/git-recovery-rollback && git show -s --format='%h %s' HEAD@{1}
7e5872b Capture incident rollback note
::exit-code::0
YouTube Short
Reset is not always lost.
After a reset, check the reflog. The old tip is usually still there long enough to recover.
LinkedIn hook
A reset does not mean the commit vanished.
Question: Have you recovered a commit from reflog during an incident?
experiments
A/B tests to run
Metric: watch_time
A: A reset does not erase the commit immediately.
B: Find the old tip in reflog.