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

Request: git add --interactive: split hunk: When can't split further, split on empty lines

From
JHJames Harvey <jamespharvey20@gmail.com>
Date
May 30, 2019, 00:19 UTC
Message-ID
<CA+X5Wn5bt-3zHUqtRDWtc0A82SFmWPuQ0+RvRLaAV6Vn24nf4g@mail.gmail.com>

When adding interactively, 's' can be used to split the current hunk. Once it gets down to where 's' reports "Sorry, cannot split this hunk", it could be useful if it would then start splitting based on empty lines, probably leaving empty lines at the top of the split hunks. It certainly wouldn't be perfect, and might create many hunks, but it would be a nice alternative to manually editing the hunk. Certainly someone could still manually edit the hunk if they didn't want to use it in a particular situation.

Example:

---------- int a() { }

int b() { } ----------

becomes

--------- int a() { } ---------

int b() { } ---------

Next: Johannes Schindelin
Message 1 of 5 in “Request: git add --interactive: split hunk: When can't split further, split on empty lines”
  1. James HarveyMay 30, 2019
  2. Johannes SchindelinMay 30, 2019
  3. Philip OakleyMay 30, 2019
  4. Johannes SchindelinMay 30, 2019
  5. Philip OakleyMay 30, 2019

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.