Reflog
Recover lost commits and branches from the reference log
The reflog is your safety net. It records every HEAD movement, so you can recover from almost any mistake.
The reflog records every time HEAD changes. It tracks commits, checkouts, resets, rebases, and more.
Reference Log (HEAD)
a1b2c3dcommit2 min ago
e4f5g6hcheckout10 min ago
i7j8k9lcommit25 min ago
m0n1o2preset30 min ago
q3r4s5tcommit1 hr ago
u6v7w8xrebase2 hr ago
y9z0a1bcommit3 hr ago
Terminal
$ git reflog
a1b2c3d HEAD@{0}: commit: fix auth bug
e4f5g6h HEAD@{1}: checkout: moving from feature to main
i7j8k9l HEAD@{2}: commit: add login form
m0n1o2p HEAD@{3}: reset: moving to HEAD~2
q3r4s5t HEAD@{4}: commit: update navbar
u6v7w8x HEAD@{5}: rebase finished
y9z0a1b HEAD@{6}: commit: initial setup