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

Re: git commit -p with file arguments

From
Christian Neukirchen <chneukirchen@gmail.com>
Date
Sep 9, 2016, 20:52 UTC
Message-ID
<87inu4bxt7.fsf@juno.home.vuxu.org>
In-Reply-To
<23de5ffe-eaf8-2d62-2202-f1bf6087d44b@gmail.com>
Jakub Narębski <jnareb@gmail.com> writes:
Show 7 quoted lines
> Which means that with "git add -p <pathspec> && git commit <pathspec>",
> the "git add -p <pathspec>" would carefully craft the <pathspec> state
> in the index... and "git commit <pathspec>" would take worktree version
> of <pathspec> for commit, ignoring what was in the index :-(
>
> Currently there is no way to create commit out of subset of the index,
> e.g. with "git commit :0:<path>"

I played around with creating a new index just for "add -p" and then committing that one. Seems to have worked...

Perhaps I'll just wrap git-commit myself then.
cu,
-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org
Previous: Jakub NarębskiNext: Jakub Narębski
Message 10 of 16 in “git commit -p with file arguments”
  1. Christian NeukirchenSep 5, 2016
  2. Duy NguyenSep 9, 2016
  3. Duy NguyenOct 5, 2016
  4. Christian NeukirchenOct 5, 2016
  5. Junio C HamanoOct 5, 2016
  6. Jacob KellerSep 9, 2016
  7. Christian NeukirchenSep 9, 2016
  8. Junio C HamanoSep 9, 2016
  9. Jakub NarębskiSep 9, 2016
  10. Christian NeukirchenSep 9, 2016
  11. Jakub NarębskiSep 10, 2016
  12. Junio C HamanoSep 11, 2016
  13. Jacob KellerSep 11, 2016
  14. Junio C HamanoSep 12, 2016
  15. Jacob KellerSep 12, 2016
  16. Jakub NarębskiSep 12, 2016

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.