From: Jim Meyering <jim@meyering.net>
To: git@vger.kernel.org
Subject: committing selected 'changed' or 'added' files works, but not 'removed'
Date: Mon, 14 May 2007 08:16:39 +0200 [thread overview]
Message-ID: <87y7jsgcag.fsf@rho.meyering.net> (raw)
Hello,
If I've just run "git-rm -f c" in a directory with a few modified
or git-added files, is there some way to commit (non-interactively)
only the removal of that selected file? I.e., not any other changes
in the working directory? git-commit -m. -- c fails with this:
error: pathspec 'c' did not match any file(s) known to git
If I use "cg-commit" instead of "git-commit", it works fine.
When I asked on IRC, "cehteh" suggested to create a temporary branch,
do the removal there, and then to rebase that change back onto the
original branch -- and to remove the disposable branch. Yes, that works,
but I want do the job with a single commit command, the same way I can
for "added" and "modified" files. And I've been trying (until now,
successfully) to wean myself away from cogito.
Why should "removed" files be handled so differently? If I cannot commit
a selected "file removal" (regardless of the state of the index), then
isn't that an opportunity to add a feature?
In case you're wondering, I want this functionality in order to make
a version control agnostic commit/diff/ChangeLog tool work the same way
with raw git as it did using cogito.
-------------------------------------------
In case an actual scenario helps, I'd like to be able to commit the
removal of "c", below without also committing the change to "b":
mkdir .j && cd .j && git-init > /dev/null && touch b c && git-add b c \
&& git-commit -q -m. && echo > b && git-rm --quiet -f c \
&& git-commit -m. -- c
The final commit above fails like this:
error: pathspec 'c' did not match any file(s) known to git.
Did you forget to 'git add'?
next reply other threads:[~2007-05-14 6:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-14 6:16 Jim Meyering [this message]
2007-05-14 7:44 ` committing selected 'changed' or 'added' files works, but not 'removed' Junio C Hamano
2007-05-14 12:48 ` Jim Meyering
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=87y7jsgcag.fsf@rho.meyering.net \
--to=jim@meyering.net \
--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