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
| --soft | Move HEAD only (keep index/WT) |
|---|---|
| --mixed | Move HEAD + index (default) |
| --hard | Discard HEAD + index + WT |
| Undo commit | git 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.
Part of GOAT Lab — 26 free, browser-based science, engineering and developer tools. No sign-up.