Git: Undoing ThingsThe command for each kind of mistake — and which ones destroy work.ComputingMatch the mistake to the row. The safe commands leave your files alone.To undoCommandSafe?Staged the wrong filegit restore --staged FILEyesEdits you want to throw awaygit restore FILEDESTROYSWrong commit messagegit commit --amendyesLast commit, keep the workgit reset --soft HEAD~1yesLast commit and the workgit reset --hard HEAD~1DESTROYSA commit already pushedgit revert SHAyesLost a commit entirelygit reflog, then reset to ityesWrong branch, not committedgit stash, switch, git stash popyesreflog remembers where HEAD has been for ~90 days. Almost nothingcommitted is ever truly lost.Git: Undoing Thingslearnposters.com
Git: Undoing Things — printable computing wall chart from LearnPosters. Free vector PDF, US Letter and A4.

What’s on the Git: Undoing Things poster

A 8-row table: To undo · Command · Safe?.

Match the mistake to the row. The safe commands leave your files alone.

reflog remembers where HEAD has been for ~90 days. Almost nothing committed is ever truly lost.

Questions about the Git: Undoing Things poster

What’s on the Git: Undoing Things poster?
A 8-row table: To undo · Command · Safe?. Match the mistake to the row. The safe commands leave your files alone. Staged the wrong file — git restore --staged FILE — yes; Edits you want to throw away — git restore FILE — DESTROYS; Wrong commit message — git commit --amend — yes; Last commit, keep the work — git reset --soft HEAD~1 — yes; Last commit and the work — git reset --hard HEAD~1 — DESTROYS; A commit already pushed — git revert SHA — yes; Lost a commit entirely — git reflog, then reset to it — yes; Wrong branch, not committed — git stash, switch, git stash pop — yes. reflog remembers where HEAD has been for ~90 days. Almost nothing committed is ever truly lost.
Who is the Git: Undoing Things poster for?
Git: Undoing Things belongs to the Computing section rather than to a school year, because computing is not something one grade owns. Anyone learning tools can pin it up — a beginner, a student mid-course, or someone revising years later.
When should you use the Git: Undoing Things poster?
Read the middle column before running anything. Two of these cannot be taken back. A wall chart earns its place by being glanceable from where the work is happening, so Git: Undoing Things belongs on the wall where that computing work actually happens, within glancing distance, rather than filed away.
What other posters go with Git: Undoing Things?
Code Review, Debugging Method and Docker Basics sit alongside Git: Undoing Things in the Computing section. Printed together they make a wall rather than a single sheet, which is how a reference set actually gets used.Code ReviewDebugging MethodDocker Basics
Is the Git: Undoing Things poster free to download and print?
Yes. Git: Undoing Things downloads as a free PDF with no account, no email and no watermark, like everything else in the Computing section. Print as many copies as you like for a home, a classroom, a library or a tutoring group; reselling the file is the only thing the licence rules out.Read the licence
What size does the Git: Undoing Things poster print at?
Git: Undoing Things is a vector PDF laid out for US Letter, and prints on A4 with Fit to page — the same file, no separate download. Because every mark on it is drawn rather than photographed, it stays sharp enlarged to A3, A2 or A1 at a copy shop. Colour carries emphasis only, so a greyscale print of Git: Undoing Things loses nothing.Printing guide

Related posters

Charts that sit alongside Git: Undoing Things on the same wall.

Browse every Computing poster, or start from the full catalogue.