Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Rescuing Your Work with Git Reflog

February 22, 2026

Ever accidentally deleted a branch or performed a 'hard reset' to the wrong commit? Before you panic and start rewriting code, check out 'git reflog'. It is essentially a local diary of every single move you have made in your repository, even the ones that are not part of the official commit history anymore.

Simply run the command, find the hash from just before the mistake happened, and use 'git checkout' or 'git reset' to jump back in time. It is the ultimate 'undo' button that has saved many developers from a very long, very stressful Friday afternoon.