Unstage an added file in Git

Posted Over 13 years ago. Visible to the public.

If you added a file by mistake, you can unstage it (but keep local changes) by saying

git reset HEAD path/to/file

This is also what git status will tell you.

NB: It works for conflicts, too, if git checkout -- <file> does not (although git tells you it would).

Henning Koch
Last edit
Over 13 years ago
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2010-09-07 17:47)