Recover and debug Git history safely
8 steps · about 3 h 40 min · Intermediate
- Establish repository state (reference, Git documentation, 20 min)
Separate working-tree, index and history changes before attempting recovery.
- Inspect project history (reference, Git documentation, 30 min)
Filter commits by path, author, date or message to narrow the investigation.
- Compare exact changes (reference, Git documentation, 30 min)
See differences between the working tree, index, commits and branches.
- Trace a line's context (reference, Git documentation, 25 min)
Find the commit that last changed a line, then read that commit rather than assigning blame blindly.
- Locate the first bad commit (reference, Git documentation, 35 min)
Use binary search and a reproducible check to isolate a regression efficiently.
- Restore selected files (reference, Git documentation, 25 min)
Recover working-tree or index content while stating the source explicitly.
- Undo a published change (reference, Git documentation, 25 min)
Create a new inverse commit without rewriting shared history.
- Recover a displaced commit (reference, Git documentation, 30 min)
Use local reference history to find work that is no longer named by a branch.