Skip to content
Rewriting

Throwing work away

The one command that really does destroy something.

`git reset --hard` moves the branch, rewrites the index and overwrites your files. Uncommitted work is gone — no reflog, no object, nothing.

The commits are a different matter. They stay in the object store and the reflog still names them, so a branch moved by mistake is recoverable until a garbage collection runs.

Knowing which half is recoverable is the difference between a bad afternoon and a lost one.

Commands in this lesson

git reset --hard
Move the branch and overwrite the index and your files — the one that loses work
No account, no backend. Everything you do stays in this browser.liter8.sh