Q | In Git you have your working tree and your repository but the necessary in-between state is the staging area. Files get staged by doing a git add. What’s the opposite of a git add, i.e. how can I “unstage” a file? |
A | Updated 25 August 2011.
Embarrassingly, I just saw the comments now over a year later and it turns out I have a lot to learn with GIT, I have not used it enough and got this completely wrong as the comments testify. I leave my deleted answer for my own education. I have turned on comment notification now!
|
This is completely wrong. As git itself suggests when you do a git status, you do git reset HEAD to unstage a file. git rm will actually delete the file and stage the changes. If you have a file stages, and try to rm, git will not do it and tell you that you can’t do that as it’s staged, or you have to use the force switch.
this is totally wrong!
etylocus is right.
This is one of the top “g.i.t u.n.s.t.a.g.e” Google hits (I added the dots to hopefully avoid bumping it even higher).
Please fix or delete it.
Yeah man. This is wrong. Please delete.
This comment has been removed by the author.
Posting the real answer would be of more value than deleting the post! π
The right way to undo ‘git add [paths]’ is ‘git reset [paths]’
Answer from http://stackoverflow.com/questions/348170/undo-git-add-before-commit
On the other hand, despite the error, this thread still solved my problem.
Maybe Google knows all to well.