Skip to content
>devspeak
← glossary
level 3Git & Version Control

Reset

also: git reset, hard reset, reset --hard

Moving your project's history back to an earlier commit. Some kinds of reset permanently delete changes you haven't committed, so treat it with care.

a bit more technical

"git reset" moves the current branch to a different commit. --soft keeps the changes staged; the default, --mixed, keeps them in the working tree; --hard discards all uncommitted changes and makes the files match the target commit. Commits after that point drop out of the branch's history.

picture it

Rewinding a tape and recording over it. You're back at the earlier point, but whatever came after may be gone.

why it matters

Agents sometimes suggest "git reset --hard" to clean up. It can erase hours of uncommitted work instantly, with no undo. Know exactly what it will delete before saying yes.

what your agent might say
agent
I can run git reset --hard to discard all changes. Warning: this permanently deletes uncommitted edits in 5 files, including yours. Should I stash them first?
how you might use it
you → your agent
Don't use git reset --hard. If you need to undo your changes, list the files first, and stash or commit anything that isn't yours.
common mistake

Thinking reset is just another word for revert. Revert adds a new undo commit and keeps history. Reset moves history backward and can destroy uncommitted work.

builds on