init: git reset
In this video we'll learn how to use
There will be times you add or remove the wrong change.
To unstage these changes, we can use
In fact, you may have noticed this suggestion when running
Let's demonstrate this by quickly creating and adding a new file.
git status to verify the file was staged.
We also notice the suggestion for using
git reset to unstage this file.
We'll streamline the suggested command by dropping
HEAD as this is the default. we'll learn how to use
git reset new-file.txt
When we run
git status we see the new file has gone back to being untracked.
git reset effectively undid our
git add command.
We can also run
git reset without passing the file argument. This will reset all staged changes.
So, in its basic usage, we can use
git reset to undo the commands like
git add and