git reset

`git reset` allows you to undo changes that haven’t been shared yet.

Example A
`git reset` will reset the Staging area to the most recent commit.
1. you have a file in Staging ready to commit and want to remove it from Staging. See this:

$ git st
On branch master
Changes to be committed:
(use “git reset HEAD …” to unstage)

modified: test.txt

Now, to remove it from Staging, use `git reset`, e.g.
git reset

Now you have:
Unstaged changes after reset:
M test.txt
[git-test (master)]$ git st
On branch master
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout — …” to discard changes in working directory)

modified: test.txt

Leave a Reply

Your email address will not be published. Required fields are marked *