I was going to unstage a file, but instead of typing:
git reset file.sh
I typed:
git reset file.sh head
And the output was:
Unstaged changes after reset:
M path/file1
M path/file2
M path/file2
....
^C
I know from git documentation that git reset has three forms
git reset [-q] [<tree-ish>] [--] <paths>...
git reset (--patch | -p) [<tree-ish>] [--] [<paths>...]
git reset [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]
But my command don't match any of the three forms.
My question is: what happened here? And Why the command operated on all my repository?
EDIT: Actually, file.sh exists, but head don't. If I use
git reset existing.file nonexisting.file
it will change the index on existing.file and will ignore the second file, and show the full list of unstaged file (normal, but resulted in a bit of panic).
If I type:
git reset nonexisting.file existing.file
it will fail. http://paste.ubuntu.com/12780596/.
Thanks to @sehe to pointing to the correct solution.