09/30/2026
Git Recovery in Six Slides: Undo, Recover, Unbreak
The commands you need twice a year
Nobody memorizes the git commands for the bad day. This deck keeps them in one place: six slides, each with the exact commands and what they do to your files. Use the arrow keys or the Next button. With scripts off, the slides read in order below.
Run the check on the first slide before you try anything else. Most recoveries start with what it shows.
Git recovery, slide by slide
Look firstgit status && git stash list && git reflog -20 answers three questions: what is uncommitted, what is set aside, and where HEAD has been. Three kinds of resetOnly --hard touches your files. --soft and --mixed move the branch pointer and leave the working tree as it is. Reset or revertOn anything you have pushed and others have pulled, use revert: it adds a commit instead of rewriting history. Reflog rescueMake the branch first, then look. A named branch keeps the commit from being cleaned up. Wrong branchThe order matters: create the branch before you reset main, and commit or stash anything uncommitted first, because --hard discards it. Escape a rebase or mergegit status says which one you are in. Abort puts you back where you started. If you cannot abort, fix the files, git add them and continue.
Where the rest is
Stash, clean and the other ways to lose work quietly are on the Git recovery cheat sheet.