Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Your Git Safety Net: The Reflog
March 5, 2026
Ever accidentally hard-reset your branch or deleted a commit you actually needed? Before you panic, try running "git reflog". It is essentially a journal of every single movement your HEAD has made in the local repository. Even if a commit is no longer part of any branch, it is likely still hanging out in the reflog for a few weeks. Find the hash of where you were before the mistake and use "git reset --hard <hash>" to travel back in time. It has saved my skin more times than I would like to admit!