tags:

views:

55

answers:

2

How to remove a file from the index ( = staging area = cache) without removing it from the file system?

Thanks.

+2  A: 

This should unstage a for you (without removing or otherwise modifying the file):

git reset HEAD <file>
David Underhill
+4  A: 

You want:

git rm --cached [file]

If you remove the --cached option, it will also delete it from the working tree. git rm is slightly safer than git reset, because you'll be warned if the staged content doesn't match either the tip of the branch or the file on disk. (If it doesn't, you have to add --force.)

John Feminella
Apparently we need the question's author to clarify what he meant by "remove".
seh