git reset — soft, mixed & hard

git reset moves HEAD, and optionally the index and working tree. --soft moves HEAD only; --mixed (default) moves HEAD + index; --hard moves HEAD + index + working tree, discarding changes.

Open the interactive DevRef Hub tool →

Key facts

--softMove HEAD only (keep index/WT)
--mixedMove HEAD + index (default)
--hardDiscard HEAD + index + WT
Undo commitgit reset --soft HEAD~1

Frequently asked questions

What is the difference between soft, mixed and hard reset?

--soft keeps index+WT, --mixed keeps WT, --hard discards everything.

Can I recover after git reset --hard?

Only committed work via reflog; uncommitted working-tree changes are lost.

Related pages

git reset is part of DevRef Hub on GOAT Lab — a free reference you can use without signing up, and it works offline. Open the tool above for any custom value.

Advertise

Part of GOAT Lab — 26 free, browser-based science, engineering and developer tools. No sign-up.