Re: feature request: git add--interactive --patch on regex-matched hunks only

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

 



On Tue, Jul 26, 2011 at 08:03:01PM +0700, Nguyen Thai Ngoc Duy wrote:

> It would be even more cool if --hunks (or whatever the name will be)
> could work without -p. I mean, if "git diff" supports it, then I can
> fine tune my regex to meet a selection of hunks I want, and verify it
> really is what I want. Then "git add --hunks=magic" and voila! (The
> "git add --hunks" without -p surely can be workaround by adding "-p",
> then accept all hunks).

Yeah, doing "yes | git add -p --hunks=foo" would probably do what you
want. But you don't really have a good way of verifying what it will add
(you could check after the fact what's left in "git diff", or what's now
in "git diff --cached", of course).

> And if diff machinery learns this, we would have "git log --hunks" too.
> 
> OK I'm asking too much..

Probably. :)

I'm not sure how useful "log --hunks" would be. The changes you commit
don't tend to be that big (well, not if you're doing it right). It seems
much more likely to have the case you brought up, which is that some
file has a bunch of boring boilerplate that doesn't need to be
changed, and you need to pick out the interesting changes from the
boilerplate changes.

I suppose if somebody committed all of the boilerplate changes (like .po
comment changes), then you would want to be able to pick them apart. But
that just seems like the wrong thing (i.e., if those comments really are
uninteresting, they should not be committed). But I don't work with .po
files at all, so maybe there is a good reason to commit them.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]