If you've added files to the staging area (the Index) accidentally - you can remove them using git reset
.
We'll first add a file to staging, but then back it out with:
git reset HEAD filename
in order to pull it back to the working directory, so it doesn't end up in a commit when we don't want it to.
You created a new file lib.js
You have add to stating area.
git status
git add .
But later you find out that you don't want to add lib.js
git log --oneline
Run:
git reset HEAD lib.js
It will untrack lib.js file.