Ad space (banner)
🌿Git Lessons
Lesson 41 / 59

Checking HEAD's Movement History with git reflog

This lesson covers checking HEAD's movement history with git reflog. It's for anyone searching "git reflog usage."

git reflog shows a behind-the-scenes history of how HEAD (your current position) has moved, which doesn't appear in a regular git log. It's your last resort for recovering a commit you accidentally deleted.

In Try It, run git reflog. Every past operation — branch switches, resets, rebases, and more — is displayed in chronological order.

A common early mistake is not knowing reflog exists at all — even in a panic moment like "I accidentally reset and lost my commit," it's reassuring to know reflog can likely get you back to the state before it disappeared.

In real teams, reflog is a genuinely reliable recovery tool for when a history-rewriting operation like rebase or reset goes wrong.

Git
Try it (type this into the pseudo terminal)
git reflog

🧑‍💻 You can type this command into the Git pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)