Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
The Git Safety Net You Forgot About: reflog
February 3, 2026
Ever mess up a tricky rebase, accidentally delete a branch, or feel like you lost commits during a chaotic merge? Don't panic! Git keeps a complete record of every place your HEAD has been, even if the commit isn't currently referenced by a branch. Just type `git reflog`. You'll see a chronological history of actions. Find the hash immediately before you broke everything, and then run `git reset --hard [that hash]`. This command is a lifesaver for rescuing seemingly lost work and proves that Git rarely, if ever, truly loses data.