You deleted a branch by accident? Seems like all your hard work is gone. What would you do? This is where git reflog comes in. git reflog logs every HEAD movement. Commits, checkouts, resets, rebases. All of it. Here's what you can do with it: 1)Recover commits after git reset --hard 2)Recover a deleted branch. Commits still exist as dangling objects. Grab the SHA, restore it: 3)Undo a bad rebase or merge. Find where HEAD was before it started. Reset to that point. How it works: Every HEAD movement gets logged to .git/logs/HEAD HEAD@{0} where you are now HEAD@{1} one move ago HEAD@{2} two moves ago. Run git reflog to see it. Add --date=iso for timestamps. Limitations worth knowing: Local only. Doesn't sync when you push. Fresh clone means empty reflog. Expires after 90 days. git gc can prune old entries before that. Only tracks commits. Unsaved changes are still gone. Reflog won't save you from everything. But most "I lost my work" panics? It handles those. Run git reflog before you panic. #git #developer #coding #github #softwareengineer
Utkarsh Bajaj thanks for sharing. It’s always important to know git commands when you are working collaboratively within a team or within a coding agent workflow
This is so useful, I have never used it before but keeping it handy for SOS situations.
Utkarsh Bajaj Clean thought 👍 Git activity is a strong signal of productivity, but what matters most is meaningful contribution and collaboration — not just commits.