Every Real Place HEAD Has Been
Every real checkout, commit, reset, rebase, and amend — newest first, each with its own real resulting commit hash.
A Commit That "Vanished"
git reflog | grep "draft notes"
git show $(git reflog | grep "draft notes" | head -1 | cut -d' ' -f1)
A commit made and then discarded with reset --hard is genuinely gone from any current branch — but reflog still names its real hash, and the commit object itself is still on disk until real garbage collection eventually runs.
A Branch, Rewritten
git reflog feature/recipe-search
Every real branch has its own reflog, not just HEAD's. An amend followed by a force-push shows up here as two real, distinct entries — the new commit, and (one step further back) the exact original it replaced.
git reflog is a real, complete, purely local log of every single place HEAD has pointed to — every commit, every checkout, every reset, every rebase, every amend. It is not part of the real commit graph and is never pushed or shared; it is the honest, private diary of everything that has genuinely happened in this one real repository.
Two real, ordinary mistakes already happened in this ~/team-recipes clone: a commit was made and then discarded with a real reset --hard, and a branch was amended and genuinely force-pushed over. Neither commit is reachable from any current real branch — but reflog remembers exactly where each one is.
git reflog
A real, complete, local-only log of everywhere HEAD (or a specific branch) has pointed to. Confirmed directly in this lab: a commit invisible to git log on any current branch was still fully readable via git show once found through reflog.
Reflog expiry
Reflog entries are not kept forever — git's real defaults expire reachable entries after 90 days and unreachable ones after 30, then real garbage collection can remove the underlying objects entirely. Reflog is a safety net for recent real mistakes, not permanent archival.
Takeaways
- git reflog is a real, complete, local-only record of everywhere HEAD has pointed to
- A commit invisible to git log on every current branch can still exist and be fully readable via reflog + git show
- Every real branch has its own reflog, not just HEAD — useful for finding a branch's state before an amend or force-push
- Reflog is not permanent — it genuinely expires (90 days reachable, 30 unreachable by default), then real garbage collection can remove the objects