| 37 | Resetting Staged Changes and Commits |
The git reset command lets you change
the HEAD—the latest commit your working
tree points to—of your repository. It modifies either the
staging area or the staging area and working tree.
Git’s ability to craft commits exactly like you want means that you
sometimes need to undo changes to the changes you staged with
git add. You can do that by calling
git reset HEAD <file to change>.
This is the most common use of the
reset and is like Subversion’s
svn revert command. Remember not to get
the two confused. (For more on git
revert, see Task 36, Reverting Commits.)
You have two options to get rid of changes completely.
git checkout HEAD <file(s) or
path(s)> is a quick way to undo changes to your ...