git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jay Soffian" <jaysoffian@gmail.com>
To: "Git List" <git@vger.kernel.org>
Subject: Are these bugs?
Date: Wed, 27 Aug 2008 19:36:47 -0400	[thread overview]
Message-ID: <76718490808271636i4de8f385pdaeb1672f06a00d7@mail.gmail.com> (raw)

1. You can't use reset in a just initialized repo:

$ mkdir testrepo
$ cd testrepo
$ echo foo > foo
$ git init
$ git add .
$ git reset
fatal: Failed to resolve 'HEAD' as a valid ref.

In the real-world, I had initialized a new repository and realized I'd
staged extra files I didn't want. I was going to "git reset" then
re-add the specific files I wanted, but that obviously failed. I
worked around this by using "git rm --cached" to get rid of what I
didn't want.

I understand why "git reset" failed, but at best the error message is
confusing to a new user.

2. "git add --ignore-errors" doesn't work with ignored files:

$ mkdir testrepo
$ cd testrepo
$ git init
Initialized empty Git repository in /Users/jay/testrepo/.git/
$ echo foo >> .git/info/exclude
$ echo foo > foo
$ echo bar > bar
$ git add --ignore-errors foo bar
The following paths are ignored by one of your .gitignore files:
foo
Use -f if you really want to add them.
fatal: no files added

Now you may ask "why are you specifying foo if you don't want to add
it?" In the real-world I was generating the list to "git add" with
xargs and it was quite a long list. It was easiest to filter out what
I didn't want through .git/info/exclude. But I ended up having to "...
| grep -v <stuff I don't want> | xargs git add".

So I think preferable would be: "Use -f if you really want to add them
or --ignore errors to continue anyway."

$ git version
git version 1.6.0.176.g8698c

Thoughts?

j.

             reply	other threads:[~2008-08-27 23:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-27 23:36 Jay Soffian [this message]
2008-08-27 23:47 ` Are these bugs? Junio C Hamano
2008-08-28  1:04   ` Stephan Beyer
2008-08-28  1:20     ` Junio C Hamano
2008-08-28  8:44       ` Benny Halevy
     [not found]   ` <76718490808271825j68ac6abch406a8e12b5849b1a@mail.gmail.com>
2008-08-28  1:26     ` Jay Soffian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76718490808271636i4de8f385pdaeb1672f06a00d7@mail.gmail.com \
    --to=jaysoffian@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).