EDIT This question can be understood in two ways, and the optimal answer is different in the two cases.
-
Question 1: I added a previously untracked file to the staging area. How can I remove this file from the staging area without removing it from the file system?
Answer 1: Use the following command, as described in John Feminella’s answer:
git rm --cached <file>
-
Question 2: I modified a file already tracked, and added my modifications to the staging area. How can I remove my modifications from the staging area? I.e., how can I unstage my modifications in the file?
Answer 2: Use the following command, as described in David Underhill’s answer:
git reset <file>