git reset
WorkflowReset current HEAD to specified state
Options & Flags
Available options for this command
--softKeep changes staged
--mixedKeep changes but unstage (default)
--hardDiscard all changes
Examples
Common usage examples
Undo last commit, keep changes
git reset HEAD~1Undo last commit, discard changes
git reset --hard HEAD~1Notes
- Use --hard with caution, it permanently deletes changes
Related Commands
You might also find these useful