How to unadd a file#
It is a very common practice to quickly add all the files that were modified to staging using:
$ git add .
As you are about to commit, you may realize one or more files should be excluded from this commit, and you shouldn't have done
git add ..
How do you "unadd" (unstage) these files now?
It's very simple to unadd them from staging, just use
get reset HEAD <file1[, file2 ...]>.
$ git reset HEAD README.md
Now when you commit the changes, the unstaged files will be excluded from the commit.
Watch out for that
git add . next time!
To unadd one or more files from staging use the command
git reset HEAD <file1[, file2 ...]>.
- Git - git-reset