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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux