Lesson 19 / 26
git reset: soft, mixed, hard
Move a branch pointer backward, with three levels of blast radius.
The three flavors
--soft keeps changes staged, --mixed (default) keeps them unstaged, --hard discards them entirely.
git reset --soft HEAD~1 # undo commit, keep changes staged
git reset HEAD~1 # undo commit, keep changes unstaged
git reset --hard HEAD~1 # undo commit AND discard changes--hard is destructive
git reset --hard permanently deletes uncommitted work. Double-check git status before running it — there's no confirmation prompt.
Quick check: Which reset mode discards changes entirely?
- --soft
- --mixed
- --hard
Answer
--hard — --hard resets both the commit history and the working directory, deleting uncommitted work.