Unstage an added file in Git

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 Over 13 years ago