Re: Stage or discard a hunk at a time?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. :)



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux