git reflog: The Command That Saved Me After I Deleted a Week of Work

Опубликовано: 16 Июль 2026
на канале: Craftsmanship of Code
559
53

In this Git reflog tutorial, I show how I recovered lost commits after accidentally running git reset --hard on the wrong commit. This video demonstrates how to recover deleted work, restore commits, and fix broken Git history using git reflog. I also talk about how this command has saved me later in my career, including from a deleted branch and from rebase situations that went completely wrong.

At the time, I didn’t fully understand what I was doing; I was just trying to fix a "mistake" in my git history. Instead, I ended up wiping out a large part of my progress. What I thought was gone forever was still recoverable through Git’s internal history tracking. This was not the only time it helped me either—I also show a couple of other real situations where git reflog saved my work.

Git can feel scary when you are learning it, but tools like reflog are exactly what make it safe to experiment and recover from mistakes. It is not a permanent backup, but most of the time mistakes happen quickly, and it can recover those recent states.

Key topics covered in this Git reflog tutorial:

How to undo git reset --hard and recover lost work
Recovering lost git commits and deleted branches
My experiences recovering from a failed Git rebase
Understanding git history, HEAD, and commands to view history
Common git mistakes and how to recover from them effectively

Timestamps:
0:00 The junior developer mistake that "deleted" my work
1:35 How git reflog saved the day (step-by-step recovery)
2:30 An important thing to know about git reflog and why every developer should learn it
2:59 My top 3 Git mistakes that git reflog has helped me recover from
3:15 Question for you

Thanks for watching, Craftsmanship of Code