Accidentally deleted a branch? Used reset --hard? Don't panic. reflog remembers everything HEAD ever pointed to — even things git log can't see anymore.
You ran git reset --hard HEAD~3
and wiped out your last 3 commits. They've vanished from git log.
But Git's reflog — the reference log —
recorded every move HEAD made. Those "lost" commits are still there.
You just need to find them in the reflog and
rescue them with git reset --hard HEAD@{n}.
The reflog saved your work. Nothing is truly lost in Git
as long as it was committed. The reflog keeps entries for
about 90 days, giving you plenty of time to recover.
Reflog records: commits, resets, rebases, checkouts,
merges — every move HEAD makes.
Remember: reflog is local only. It's not pushed to the remote. Your safety net lives on your machine.