Three modes. One footgun. Learn it cold.
Move the current branch pointer to a different commit, optionally adjusting the index and working tree. Three modes: --soft (just move HEAD), --mixed (default — move HEAD + reset index), --hard (move HEAD + reset index + reset working tree). One footgun, three speeds.
Reset is branch-pointer surgery. --soft moves the pointer; --mixed also resets the index to match the new commit (your working tree changes survive but become unstaged); --hard resets everything, discarding uncommitted work. There is no recovery for --hard outside the reflog.
git reset [-q] [<tree-ish>] [--] <pathspec>...
git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...]
git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]| Flag | What it does |
|---|---|
--soft <commit> | Move HEAD to <commit>. Index and working tree untouched. Your changes appear as 'staged for commit'. |
--mixed <commit> | (default) Move HEAD; reset index to match. Working tree untouched — your changes appear as 'unstaged'. |
--hard <commit> | ⚠️ Move HEAD; reset index and working tree. ⚠️ Destroys uncommitted work. |
--keep <commit> | Like --hard but refuses if it would discard local changes. |
--merge <commit> | Reset like --hard but preserves working-tree changes that aren't between the commits. |
<commit> -- <path> | Restore <path> in the index from <commit>. Doesn't move HEAD. |
$ git reset --soft HEAD~1$ git reset HEAD~1 # default: --mixed$ git reset --hard origin/main # ⚠️ destructivegit restore --staged).$ git reset HEAD -- src/main.cgit restore instead — clearer intent.reset --hard of a published branch then push: only do it with --force-with-lease and team consent.--hard discards working-tree changes silently. There is no confirmation. You can sometimes recover via the reflog if the commits still exist; you cannot recover never-committed working-tree changes.reset moves the current branch — not HEAD by itself. If HEAD is detached, reset still works but the branch isn't being moved.--merge or --abort-flow handling.Hit each option, then Check answers. Score is recorded; Next is always open.