DEV Community

Toolloom
Toolloom

Posted on • Originally published at toolloom.com on

Lost your commits? Git reflog to the rescue!

We've all been there: you perform a force push, a messy rebase, or accidentally delete a local branch, and suddenly your hard work seems gone forever. Before you panic, run git reflog in your terminal. Git keeps a silent, chronological diary of almost every action you take locally, even if those commits are no longer attached to any active branch.

Once you find the commit hash of your lost work in the reflog list, you can easily resurrect it by running git checkout or creating a new branch from that point. It's the ultimate safety net that will save your skin more than once.

Top comments (0)