public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "David Kågedal" <davidk@lysator•liu.se>
To: git@vger•kernel.org
Subject: Removing files
Date: Thu, 11 Jan 2007 21:10:20 +0100	[thread overview]
Message-ID: <87bql5cok3.fsf@morpheus.local> (raw)

I'm wondering what the best way to commit the removal of a file is.

Let's assume that I have a file "foo" in my tree, that I have removed
from my working tree (e.g. by using patch -E).

git status shows:

  $ git status
  # On branch refs/heads/messages
  # Changed but not added:
  #   (use "git add <file>..." to incrementally add content to commit)
  #
  #       deleted:    foo

Ok, so I try to follow the instructions in the message:

  $ git add foo
  fatal: pathspec 'foo' did not match any files

Ok, so that didn't work.  Let's try rm instead:

  $ git rm foo
  fatal: pathspec 'foo' did not match any files

Hm, something is wrong here.  But hey, there's a -f option to rm that
claims to prevent the "up-do-date check"

  $ git rm -f foo
  fatal: pathspec 'foo' did not match any files

Finally, I have to resort to using update-index.

  $ git update-index --remove foo
  fatal: pathspec 'foo' did not match any files

Since I believe that the idea is to move to an interface where you use
e.g. "git add" instead of explicitly mentioning the index, I think
this is bad.

What could be the correct command for this situation.  Some suggestions:

  $ git add foo
  $ git add --remove foo
  $ git rm foo
  $ git rm -f foo

-- 
David Kågedal

             reply	other threads:[~2007-01-11 20:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-11 20:10 David Kågedal [this message]
2007-01-11 21:36 ` Removing files Alex Riesen
2007-01-11 22:25   ` Seth Falcon
2007-01-11 22:41 ` Junio C Hamano
2007-01-11 23:19   ` Eric Wong
2007-01-11 23:36   ` Junio C Hamano
2007-01-11 23:37   ` [PATCH] git-status: wording update to deal with deleted files Junio C Hamano
2007-01-11 23:56     ` Carl Worth
2007-01-12  0:13       ` Junio C Hamano
2007-01-12  1:28         ` Carl Worth
2007-01-12 19:48           ` Jakub Narebski
2007-01-12  0:07     ` Jeff King
2007-01-12 22:13     ` Juergen Ruehle
2007-01-11 23:41 ` Removing files Carl Worth
2007-01-12  0:17   ` Jeff King

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=87bql5cok3.fsf@morpheus.local \
    --to=davidk@lysator$(echo .)liu.se \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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