tags:

views:

1128

answers:

2

Situation: I have a Git repository with files already in the index. I make changes to several files, open Git and add these files to my staging area with "git add ."

Question: How do I remove one of those files from the staging area but not remove it from the index or undo the changes to the file itself?

+9  A: 

If I understand the question correctly, you simply want to "undo" the git add that was done for that file.

If that is the case, then git reset HEAD <file> will do the job.

Your modifications will be kept and the file will once again show up in the modified, but not yet staged set of git status.

See the git reset man page for details.

Tim Henigan
Thanks... I just noticed that that is stated just above the staged files. Guess I've been looking at that screen so long I was selectively choosing what I wanted to see.
PHLAK
A: 
git rm --cached FILE

,

git rm -r --cached CVS */CVS