Re: wishlist: "--cached|--staged" to "git commit file(s)"

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

 



Yaroslav Halchenko <yoh@xxxxxxxxxxxxxx> 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.





[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