The git reset Command
Learn how to recover the previous state of our Git repository.
Significance of git reset
The git reset
command uncommits the tracked changes. After a reset, commits are removed. The removed changes are put into our working directory, either in the staging area or as untracked changes.
Different flags for the git reset
command
There are three options to perform a reset:
$ git reset --soft
$ git reset --mixed
$ git reset --hard
Let’s discuss the three stages for file changes to understand variations of the reset command:
- The
--soft
option resets the changes into the staged area. - The
--mixed
flag takes items out