Choose How to Undo With git reset Modes
Use --soft, --mixed or --hard to control what survives a reset.
Run git reset --soft HEAD~1 to move HEAD back while keeping changes staged.
01Command
Command
$ git reset --soft HEAD~102What it does
reset moves the current branch and optionally updates the index and working tree: soft keeps everything staged, mixed (default) unstages, hard discards. Knowing the modes is what lets you reshape local history precisely from the shell.
03Risk
!Warning: --hard permanently discards uncommitted changes; commit or stash first if the work matters.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- git-reset documentationEvidence: Documents soft, mixed and hard reset and their effect on index and working tree.
Last verified: 2026-10-13 · Category: Developer