git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* two git-cherry-pick enhancements
@ 2008-05-21 16:38 Nico -telmich- Schottelius
  2008-05-21 18:36 ` Govind Salinas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nico -telmich- Schottelius @ 2008-05-21 16:38 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

Hello!

When using git-cherry-pick there are two things missing for me and just
wondered how you see it (or maybe have a good solution):

- Apply only parts of the patch which applies to <file ...>:
   I sometimes want to apply patches only to some, but not all
   files the patch introduces

- Interactively selecting which parts to apply:
   I want only 7 out of 10 changes the patch introduces.
   It would help alot, if I could choose which parts I want
   to apply for every part of the patch.

Anything planned like that or did I oversee the right way?

Sincerly

Nico

P.S.: Please CC me on reply, I am not subscribed.

-- 
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/

PGP: BFE4 C736 ABE5 406F 8F42  F7CF B8BE F92A 9885 188C

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: two git-cherry-pick enhancements
  2008-05-21 16:38 two git-cherry-pick enhancements Nico -telmich- Schottelius
@ 2008-05-21 18:36 ` Govind Salinas
  2008-05-22  8:58 ` Sitaram Chamarty
  2008-05-22  9:29 ` Johannes Schindelin
  2 siblings, 0 replies; 4+ messages in thread
From: Govind Salinas @ 2008-05-21 18:36 UTC (permalink / raw)
  To: Nico -telmich- Schottelius; +Cc: git

On Wed, May 21, 2008 at 11:38 AM, Nico -telmich- Schottelius
<nico-git-20080521@schottelius.org> wrote:
> Hello!
>
> When using git-cherry-pick there are two things missing for me and just
> wondered how you see it (or maybe have a good solution):
>
> - Apply only parts of the patch which applies to <file ...>:
>   I sometimes want to apply patches only to some, but not all
>   files the patch introduces
>
> - Interactively selecting which parts to apply:
>   I want only 7 out of 10 changes the patch introduces.
>   It would help alot, if I could choose which parts I want
>   to apply for every part of the patch.
>
> Anything planned like that or did I oversee the right way?
>
> Sincerly
>
> Nico
>
> P.S.: Please CC me on reply, I am not subscribed.
>

You could "git cherry-pick --no-commit <id>" and then "git add -p"

-Govind

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

* Re: two git-cherry-pick enhancements
  2008-05-21 16:38 two git-cherry-pick enhancements Nico -telmich- Schottelius
  2008-05-21 18:36 ` Govind Salinas
@ 2008-05-22  8:58 ` Sitaram Chamarty
  2008-05-22  9:29 ` Johannes Schindelin
  2 siblings, 0 replies; 4+ messages in thread
From: Sitaram Chamarty @ 2008-05-22  8:58 UTC (permalink / raw)
  To: git

On Wed, May 21, 2008 at 10:08 PM, Nico -telmich- Schottelius
<nico-git-20080521@schottelius.org> wrote:
> - Apply only parts of the patch which applies to <file ...>:
>   I sometimes want to apply patches only to some, but not all
>   files the patch introduces
>
> - Interactively selecting which parts to apply:
>   I want only 7 out of 10 changes the patch introduces.
>   It would help alot, if I could choose which parts I want
>   to apply for every part of the patch.

Both of these are (often, though not always) signs that commits are
not granular enough.  Your branch maintainer or developer has combined
unrelated things into one commit.  In an ideal world, he would put
each piece as a separate commit, such that if you pick one of those
apart, it doesn't make sense.

This is also usually a sign of someone using a central VCS model (or
mental model) on that side.

Unless you have no control over who sends you these commits, you may
want to address that also in whatever way possible.

IMO stuff like "git add -a" (and the GUI equivalents) were meant for
your own development, so that you can essentially re-write history in
a sane sequence after having worked on a complex task.

Regards,

Sitaram

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

* Re: two git-cherry-pick enhancements
  2008-05-21 16:38 two git-cherry-pick enhancements Nico -telmich- Schottelius
  2008-05-21 18:36 ` Govind Salinas
  2008-05-22  8:58 ` Sitaram Chamarty
@ 2008-05-22  9:29 ` Johannes Schindelin
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2008-05-22  9:29 UTC (permalink / raw)
  To: Nico -telmich- Schottelius; +Cc: git

Hi,

On Wed, 21 May 2008, Nico -telmich- Schottelius wrote:

> When using git-cherry-pick there are two things missing for me and just 
> wondered how you see it (or maybe have a good solution):
> 
> - Apply only parts of the patch which applies to <file ...>:
>    I sometimes want to apply patches only to some, but not all
>    files the patch introduces
> 
> - Interactively selecting which parts to apply:
>    I want only 7 out of 10 changes the patch introduces.
>    It would help alot, if I could choose which parts I want
>    to apply for every part of the patch.
> 
> Anything planned like that or did I oversee the right way?

Conceptually, this is really not cherry-picking _commits_.  For example, 
the commit message will typically be all wrong if you pick only one 
change.  Also, if I were the author of the original patch, I would not be 
happy for you to label me author of the cut-down (and possibly invalid) 
commit.

Therefore I suggest (just like on IRC the other day):

	git show <commit> -- <file(s)> | git apply

possibly followed by

	git add -i

or

	git add -p <file>

Hth,
Dscho

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

end of thread, other threads:[~2008-05-22  9:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 16:38 two git-cherry-pick enhancements Nico -telmich- Schottelius
2008-05-21 18:36 ` Govind Salinas
2008-05-22  8:58 ` Sitaram Chamarty
2008-05-22  9:29 ` Johannes Schindelin

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 NNTP newsgroup(s).