From: Junio C Hamano <gitster@pobox.com>
To: Yaroslav Halchenko <yoh@onerussian.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: wishlist: "--cached|--staged" to "git commit file(s)"
Date: Mon, 13 Aug 2018 14:33:48 -0700 [thread overview]
Message-ID: <xmqqva8e2bpf.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180813162236.GO732@hopa.kiewit.dartmouth.edu> (Yaroslav Halchenko's message of "Mon, 13 Aug 2018 12:22:36 -0400")
Yaroslav Halchenko <yoh@onerussian.com> writes:
> command. ATM there is no non-interactive (via --patch/--interactive I
> think it is possible) way to commit selected subset of staged files not
> from the worktree (as it is done with "git commit file(s)") but from the
> index.
Hmph, so
edit A B C
git add A B
edit A B C
git commit --cached B
would create a commit that is different from the original HEAD by
the edit to file B you did in the first step, but not the edit to A
or C, or edit to B after you did "git add"?
That sounds like a useful feature. If you do not need that "exclude
the later edit since the last 'git add'", you can do "git commit B",
but if you added crufts to B in the working tree since you added a
good copy of B to the index, that would not do what you want to do.
Sounds like a good starter project for somebody who wants to try to
get their hands dirty. I think it is just the matter of updating
builtin/commit.c::prepare_index() where COMMIT_PARTIAL is handled,
skipping "(2) update the index with the given paths" when "--cached"
option is given, but doing everything else in that codepath.
next prev parent reply other threads:[~2018-08-13 21:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-13 16:22 wishlist: "--cached|--staged" to "git commit file(s)" Yaroslav Halchenko
2018-08-13 21:33 ` Junio C Hamano [this message]
2018-08-14 0:37 ` Yaroslav Halchenko
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=xmqqva8e2bpf.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=yoh@onerussian.com \
/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).