The git reset command changes your
repository and working directory to a known state. Specifically,
git reset adjusts the
HEAD ref to
a given commit, and by default, updates the index to match that commit.
If desired, git reset can also modify your working
directory to mirror the revision of your project represented by the
construe git reset as “destructive”
because it can overwrite and destroy changes in your working directory.
Indeed, data can be lost. Even if you have a backup of your files, you
might not be able to recover your work. However, the whole point of this
command is to establish and recover known states for the
HEAD, index, and working directory.
The git reset command has three main options:
--soft changes the
HEAD ref to point to
the given commit. The contents of your index and working directory
are left unchanged. This version of the command has the least
effect, changing only the state of a symbolic reference so it
points to a new commit.
HEAD to point to the
given commit. Your index contents are also modified to align with
the tree structure named by commit, but your working directory
contents are left unchanged. This version of the command leaves
your index as if you had just staged all the changes represented
by commit, and it tells you what remains modified in your working
--mixed is the default mode for