Move HEAD back one commit and leave changes in the working tree.
Section: Reset Basics
Undo last commit and unstage changes
bash
bash
git reset --mixed HEAD~1Explanation
`--mixed` is the default reset mode and is commonly used when you want to recommit changes differently.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Reset Basics
Undo last commit but keep everything staged
Move HEAD back one commit while preserving index and working tree.
Discard last commit and local changes
Move HEAD back one commit and discard index and working tree changes.
Unstage a single file
Remove a path from the index without changing its contents in the working tree.
Reset out of a conflicted merge state
Try to leave local changes intact while backing out of a merge-like operation.
Revert a single commit
Create a new commit that reverses an earlier commit.
Discard unstaged changes in a file
Restore a file in the working tree from the index.