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

Re: Autosplit option for git add -p

From
Christian Couder <christian.couder@gmail.com>
Date
Jun 8, 2024, 10:43 UTC
Message-ID
<CAP8UFD3JM_h1BvK59R4wT1DeZyo6o-9T3GXGK8xE6vLnDMDCaQ@mail.gmail.com>
In-Reply-To
<20240607120530.74297526@yuvnserver>
Hi,
On Fri, Jun 7, 2024 at 11:06 AM Konstantin Tokarev <annulen@yandex.ru> wrote:
Show 6 quoted lines
>
> Hello all,
>
> Is there any option in git to make `git add -p` split hunks by
> default, just like 's' was pressed automatically? If no, how would one
> implement such an option?

It doesn't look like there is any option to do that. About implementing it, it depends if it would be a command line option or a config option.

Anyway I think you might want to take a look at the run_add_p() function in "add-patch.c".

> My use case: I've recently started working with big LaTeX document
> having every paragraph as a single line. As a result, hunks quickly
> become larger than screen, so that splitting is highly desirable.
Best!
Previous: Konstantin TokarevNext: Dragan Simic
Message 2 of 4 in “Autosplit option for git add -p”
  1. Konstantin TokarevJun 7, 2024
  2. Christian CouderJun 8, 2024
  3. Dragan SimicJun 8, 2024
  4. Junio C HamanoJun 8, 2024

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.