Unstage a file in Git
When you stage a file in Git, you instruct Git to track changes to the file in preparation for a commit. To instruct Git to disregard changes to a file, and not include it in your next commit, unstage the file.
To remove files from stage use
reset HEAD, where HEAD is the last commit of the current branch. This unstages the file but maintains the modifications.
git reset HEAD <file>
To revert the file back to the state it was in before the changes:
git checkout -- <file>
To remove a file from disk and repository, use
git rm. To remove a directory, use the
git rm '*.txt' git rm -r <dirname>
To keep a file on disk but remove it from the repository (such as a file you want to add to
.gitignore), use the
rmcommand with the
git rm <filename> --cache