intermediateUndoing Changes
Reset (soft, mixed, hard)
The Definition
Reset moves HEAD and optionally updates the staging area and working directory.
Mental Model
"Reset is like rewinding a tape. Soft rewinds just the position (HEAD), mixed rewinds position and clears the review tray (staging), hard rewinds everything including your work."
Visual Simulation
Live Engine
SOFT
Only moves HEAD. Changes stay staged.
MIXED
Moves HEAD + resets Stage. Changes stay in Work.
HARD
Moves HEAD + wipes Stage & Work. Changes LOST.
Watch Out (Common Pitfalls)
!
Using --hard reset without understanding it discards work
!
Not knowing which reset mode to use
!
Resetting shared commits and confusing others
Hands-on Command
shell
~ $
git reset --soft HEAD~1 (keep changes staged)
git reset --mixed HEAD~1 (keep changes unstaged)
git reset --hard HEAD~1 (discard changes)