← cd ../posts

git reflog saved my week

Jul 05, 2026#write-up

Friday, 6pm. A rebase gone sideways, a force-push on top of it, and a branch that looked like three days of work had evaporated.

the panic

$ git log --oneline
a1f2c3d (HEAD -> feature) wip
# ...where are my other 14 commits?

the rescue

Git almost never deletes commits — it just stops pointing at them. The reflog remembers every place HEAD has been:

$ git reflog
e4d5f6a HEAD@{2}: rebase (start)
9b8c7d6 HEAD@{3}: commit: the good stuff

$ git reset --hard 9b8c7d6

Everything came back. Three days of work recovered in ninety seconds.

the lesson

Commits are only truly gone after garbage collection, which takes weeks by default. Before you panic: git reflog first, coffee second, rewriting history from memory never.