Quick Notes84 words
Recovering data with Git — quick notes
Recovering data — quick notes
| Situation | Command |
|---|---|
| Lost commit after reset/rebase | git reflog → checkout/reset |
| Deleted branch | git reflog → git branch |
| One commit from elsewhere | git cherry-pick |
| Undo a pushed commit | git revert |
| Restore a deleted file | git restore --source=<commit> |
- Reflog is local and expires — it saves your machine only.
- Shared branch → revert (new commit). Never reset (rewrites history).