# git reset: soft, mixed, hard — Git Fundamentals: Commits, Branches and Collaboration

Source: https://www.skillbyai.com/en/git/git-reset-modes

> Move a branch backward with git reset --soft, --mixed and --hard and know how much each one discards.

## The three flavors

`--soft` keeps changes staged, `--mixed` (default) keeps them unstaged, `--hard` discards them entirely.

```bash
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.

**Quiz:** Which reset mode discards changes entirely?

- [ ] --soft
- [x] --hard
- [ ] --mixed
- [ ] --keep

*Answer:* --hard. --hard resets both the commit history and the working directory, deleting uncommitted work.
