Just use the git rm command, there are two options ,
One is git rm --cached " file path " , which does not delete the physical file, but only deletes the file from the cache;
One is git rm --f "filepath" , which not only removes the file from the cache, but also removes the physical file (without recycling to the trash).
2016.0528.0904 update:
[ Other ] What is the difference between git rm --cache and git reset HEAD ?
If you want to delete a file, it is better to use git rm file_name instead of rm file_name directly in the workspace .
If a file has been added to the staging area and there is no commit yet , if you don't want this file, there are two ways:
1. Empty the staging area with the contents of the repository, git reset HEAD but use it with caution
2 , only delete specific files from the staging area, git rm --cached xxx