git reset
Similar to git add
and git checkout
, git reset
can take various forms, and the usual ones, you probably know. Here I’ll detail a
single highly useful option.
git reset -p
The -p
stands for “patch.” This will take you step by step through each change in your set of currently-unstaged
changes. It will show you each one and ask whether you’d like to unstage it.
For more details, please see the notes on git add
.
How and why to use git reset -p
This command is great for tightening up commits by making sure only changes associated with the subject of the commit are included.