What does Git reset change, and how can I understand its effects first?
Quick answer
For git reset with a commit argument, the mode determines which parts of your repository change: the branch reference, the staging area (index), and the working tree. --soft changes only the branch reference; the default --mixed also updates the index; --hard additionally makes working files match the index and can overwrite work. Inspect status and diffs first, and preserve changes you need. [S1][S2]
The question, the details, the next step.
A practical checklist
Confirm whether the command uses a commit argument; path-based reset has different effects.
Write down the intended target commit and mode (
--soft,--mixed, or--hard).Run
git statusand note staged, unstaged, and untracked paths.Use verbose status output if you need to inspect staged and unstaged textual differences.
Preserve needed work separately before considering a reset, especially before
--hard.If you cannot explain which repository layers the chosen mode changes, pause and get help.
A few more useful answers
Is `--mixed` the same as `--hard`?
No. Both move the branch reference and update the index, but --hard additionally makes working files match the index and can overwrite work. [S1]
Does `git status` protect my changes?
No. It helps you inspect staged, unstaged, and untracked paths; it is not a backup. Preserve needed work separately. [S2]
Does this explanation cover `git reset -- path`?
No. The effects described here are for reset with a commit argument; path-based reset has different effects. [S1]
Sources
References used for this guide.
- [S1] Pro Git: Reset Demystified git-scm.com · Checked
- [S2] Git: git-status documentation git-scm.com · Checked
