From: Jeff King <peff@peff.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: Can we do better than "git checkout/add -p"
Date: Wed, 12 Aug 2026 17:44:03 -0400 [thread overview]
Message-ID: <20260812214403.GD152730@coredump.intra.peff.net> (raw)
In-Reply-To: <21db84ba-3894-23e9-9f17-ceeafb1990c2@gmx.de>
On Wed, Aug 12, 2026 at 10:40:08AM +0200, Johannes Schindelin wrote:
> > My current workaround is not to use "git checkout -p" and instead
> > (e)dit an undesirable hunk into a no-op hunk. This is serviceable,
> > but with two caveats:
> >
> > - The underlying 'apply' machinery does not see a truly no-op,
> > context-only hunk. You'd need to pretend removing an existing
> > line and adding the same line back.
> >
> > - (e)dit applies the edited hunk right away without giving the user
> > a chance to proofread and approve or reedit.
>
> I, too, often find myself in exactly that kind of need. That's why I was
> *so* disappointed when
> https://lore.kernel.org/git/20260325075055.354709-1-luizedc1@gmail.com/
> was shot down unceremoniously. I still think that would be a good
> addition. I even opened https://github.com/gitgitgadget/git/issues/1828
> and sketched
> https://github.com/git/git/compare/master...dscho:git:add-p-stash-mode to
> the same extent.
>
> Maybe it is time to revisit that verdict, and see whether there is really
> no way to accept that clearly needed functionality.
Thanks for digging up that link. After reading Junio's message that
started this thread, I _thought_ we had discussed this a dozen times
already, but after searching the archive could only come up with this
thread:
https://lore.kernel.org/git/20161102223705.qycdo3j2bvndi7ev@sigill.intra.peff.net/
But the one you linked is another example, and nicely links back
recursively to at least two other instances. ;)
I see I am quoted in one of them as "it's a little weird for add -p to
change the working tree", but I want to make clear that I _don't_ oppose
a feature like this. I think it would be super useful. We may find a way
to avoid that "weird" property (e.g., by putting the "combined"
stash/add mode under a different command's "-p"), or we may just accept
it.
-Peff
next prev parent reply other threads:[~2026-08-12 21:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 4:02 Can we do better than "git checkout/add -p" Junio C Hamano
2026-08-07 7:38 ` Christian Couder
2026-08-07 11:24 ` D. Ben Knoble
2026-08-07 15:50 ` Junio C Hamano
2026-08-07 20:12 ` D. Ben Knoble
2026-08-07 20:26 ` Junio C Hamano
2026-08-10 6:03 ` Patrick Steinhardt
2026-08-10 7:26 ` Stefan Haller
2026-08-10 8:45 ` Patrick Steinhardt
2026-08-10 15:23 ` Junio C Hamano
2026-08-11 5:06 ` Patrick Steinhardt
2026-08-12 8:40 ` Johannes Schindelin
2026-08-12 21:44 ` Jeff King [this message]
2026-08-12 22:35 ` Junio C Hamano
2026-08-12 22:31 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260812214403.GD152730@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.