[Bug] git-status shows bad instructions prior to first commit

From: Rhodes, Kate <hidden>
Date: 2016-06-15 22:44:13

git-status incorrectly reports that you should

# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#


when working on the Initial commit.

To reproduce
mkdir foo
cd foo
touch a.txt
git init
git add a.txt
git status


The problem is, obviously, that calling
git reset HEAD a.txt
will result in
fatal: Failed to resolve 'HEAD' as a valid ref.

Why this is important:
New users are Going to accidentally add files they didn't mean to in  
their first trials with Git. Providing instructions guaranteed to  
error when people are just getting started with it will give git a bad  
image and hurt adoption. Also,  just about every time I've added a  
sizable project to a new version control system I've accidentally  
added a file before the first commit, usually something that should be  
added to the ignore file, but still, I think this isn't some random  
isolated problem that people never encounter.

While we're at it, can someone please explain to me how to remove a  
file from the index prior to the first commit? I'm stumped.

-masukomi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help