public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* Discussion for interactive --patch commands to get --unified support
@ 2025-04-29  9:16 Leon Michalak
  2025-04-29 16:48 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Leon Michalak @ 2025-04-29  9:16 UTC (permalink / raw)
  To: git

Hi everyone!

I am a big fan of `git diff` with a custom `diff.context` setting to
increase the context lines (which also extends to other commands like
`git show` which I really like). As well as this, I am also a frequent
user of `git add --patch` (and also the other interactive `--patch`
variants such as reset).

As I've grown to use and appreciate these features even more, I have
noticed and been bothered that `git add --patch` doesn't have a (easy)
way of configuring how many context lines you see. There is a
stackoverflow post
(https://stackoverflow.com/questions/6711670/git-show-more-context-when-using-git-add-i-or-git-add-e)
which mentions you can do `GIT_DIFF_OPTS=-u<number> git add -p` which
does work however isn't very user friendly or convenient.

It would be great if it was possible to start a discussion how this
could be made better (and I would be happy to submit a patch if all is
good). Whilst brainstorming briefly, here are a few options I have
thought of that could solve this pain point, some not mutually
exclusive:
- `-U<number>/--unified=<number>` command line options to the
interactive patch commands (all builtins who call `run_add_p`)
- make `diff.context` setting extend to the interactive patch commands
(not sure how a change like this would be welcomed considering it
could change users command outputs seemingly out of nowhere)
- add an `interactive.context` setting that would work like the
existing `diff.context` setting but apply only to the interactive
patch commands

Is this feature something people would welcome, and what are your thoughts?

Thanks!

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-05-02 18:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29  9:16 Discussion for interactive --patch commands to get --unified support Leon Michalak
2025-04-29 16:48 ` Junio C Hamano
2025-04-29 22:09 ` Jeff King
2025-04-30  8:04   ` Leon Michalak
2025-04-30 14:40     ` Junio C Hamano
2025-05-02 14:33   ` Phillip Wood
2025-05-02 14:39 ` Phillip Wood
2025-05-02 16:14   ` Leon Michalak
2025-05-02 16:23     ` Leon Michalak
2025-05-02 16:57     ` Junio C Hamano
2025-05-02 17:13       ` Leon Michalak
2025-05-02 18:36         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox