git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Cameron Steffen <cam.steffen94@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Stage or discard a hunk at a time?
Date: Mon, 22 Apr 2019 15:28:21 -0400	[thread overview]
Message-ID: <20190422192821.GA22798@sigill.intra.peff.net> (raw)
In-Reply-To: <CAAVFnNminTx_z9Y=jhzDnT0n5_zGD_k2SA84HQqMvKHJSvKcSA@mail.gmail.com>

On Wed, Jan 16, 2019 at 01:09:03PM -0600, Cameron Steffen wrote:

> I have this feature idea for git. There should be a command that
> effectively combines git add -p and git checkout -p so that I can
> navigate changed hunks and either stage or discard them.
> 
> There is already a SO question asking about this exactly...
> https://stackoverflow.com/questions/11538650/simultaneously-git-add-p-and-git-checkout-p
> 
> Has this been discussed before? Is this a reasonable request? If so, I
> might look into contributing the change myself.

This is something I've sometimes wanted, too. I don't think it would be
_too_ hard to do by modifying the add-interactive code. Both of those
operations are driven by the same code; see the %patch_modes hash in
git-add--interactive.perl, which defines the various situations. You
would need to modify the actual code to handle the tri-state (there is
not just "yes, apply it" and "no, leave it alone", but now "apply /
discard / skip"). But it seems do-able.

If you do plan to work on it, be aware that the perl bits of
add--interactive are being re-written in C. So it might make sense to
target the new C implementation instead of modifying the perl.

-Peff

PS Sorry for the slow reply, and I hope you're still interested in the
   topic. Your message got throw onto my "interesting, should reply"
   pile and I just happened to see it while clearing out old mails. :)

  reply	other threads:[~2019-04-22 19:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 19:09 Stage or discard a hunk at a time? Cameron Steffen
2019-04-22 19:28 ` Jeff King [this message]
2019-04-30 23:19   ` Johannes Schindelin
2019-04-28  8:47 ` David Aguilar

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190422192821.GA22798@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=cam.steffen94@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).