git reset --soft vs --mixed vs --hard Explained
git reset moves the current branch pointer to a different commit, and its mode controls what happens to the changes in between.
Published September 29, 2026
git reset moves the current branch pointer to a different commit, and its mode controls what happens to the changes in between.
Key points
- --soft keeps all changes staged, ready to be re-committed differently
- --mixed (the default) unstages the changes but keeps them in your working directory as edits
- --hard discards the changes completely, resetting your working directory to match the target commit exactly — this is destructive
Example
git reset --soft HEAD~1