git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Yaroslav Halchenko <yoh@onerussian.com>
Date
Aug 14, 2018, 00:37 UTC
Message-ID
<20180814003712.GK580@hopa.kiewit.dartmouth.edu>
In-Reply-To
<xmqqva8e2bpf.fsf@gitster-ct.c.googlers.com>
On Mon, 13 Aug 2018, Junio C Hamano wrote:
> > 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"?
yes
> 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.
exactly
> Sounds like a good starter project for somebody who wants to try to
> get their hands dirty...
asking "around" ;-)
-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        
Previous: Junio C Hamano
Message 3 of 3 in “wishlist: "--cached|--staged" to "git commit file(s)"”
  1. Yaroslav HalchenkoAug 13, 2018
  2. Junio C HamanoAug 13, 2018
  3. Yaroslav HalchenkoAug 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.