Recovering Lost Work
Part of the Git course
At some point you will type a command, press Enter, watch the terminal print something calm and final, and realise you have just deleted a day's work. Everyone does it. The good news, and it is the single most reassuring fact in all of Git: if you committed it, it is almost certainly still there. Git does not throw commits away when a branch stops pointing at them.
There is one important limit, and it is worth stating before anything else. This safety net only catches work that was committed at some point, meaning saved into a snapshot with git commit. Changes that were only ever sitting in your editor, never staged and never committed, are not in Git's storage at all, so a git restore that wipes them really does wipe them. ...
Want to learn Git Recovering Lost Work in a real environment?
Click below, get a fresh Linux box with Git ready to go, and work through Recovering Lost Work hands-on with an AI tutor that knows your code.
Start this lessonRecovering Lost WorkWhat you'll learn
- Git reflog
- Recovering from reset --hard
- Git fsck --lost-found
- 30-day grace period
Read this lesson in your language
All lessons in this course
13 lessons- 1Init and Your First Commit25 min
- 2Status, Diff, and Log25 min
- 3Branches and Merging30 min
- 4Resolving Merge Conflicts30 min
- 5Remotes: Push, Pull, Fetch30 min
- 6Stash and Cherry-pick25 min
- 7Rebasing30 min
- 8Interactive Rebase and Squashing30 min
- 9Tags and Releases20 min
- 10Branching Workflows20 min
- 11Recovering Lost Work25 min
- 12Hooks25 min
- 13Capstone: A Full Pull Request Flow40 min
