git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* cherry-pick --message?
@ 2017-03-21 16:05 Andreas Krey
  2017-03-21 17:00 ` Jeff King
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Krey @ 2017-03-21 16:05 UTC (permalink / raw)
  To: git

Hi all,

I have an slightly unusual usecase for cherry-pick:
I want to modify the commit message that is used in the process,
e.g. do an d/^PROP:/ on it, but unfortunately -m does something
else here.

And there is no --message here for good reason, as cherry-pick
can pick multiple commits and so on. Bad for me, though.

So, am I down to the combo of format-patch and apply, or is there
an easier way? (I'd also like to end up in the same state as with
cherry-pick should there be conflicts.)

- Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

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

* Re: cherry-pick --message?
  2017-03-21 16:05 cherry-pick --message? Andreas Krey
@ 2017-03-21 17:00 ` Jeff King
  2017-03-21 17:07   ` Andreas Krey
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff King @ 2017-03-21 17:00 UTC (permalink / raw)
  To: Andreas Krey; +Cc: git

On Tue, Mar 21, 2017 at 05:05:20PM +0100, Andreas Krey wrote:

> Hi all,
> 
> I have an slightly unusual usecase for cherry-pick:
> I want to modify the commit message that is used in the process,
> e.g. do an d/^PROP:/ on it, but unfortunately -m does something
> else here.
> 
> And there is no --message here for good reason, as cherry-pick
> can pick multiple commits and so on. Bad for me, though.
> 
> So, am I down to the combo of format-patch and apply, or is there
> an easier way? (I'd also like to end up in the same state as with
> cherry-pick should there be conflicts.)

There's "cherry-pick --edit".

I had to look it up, though. For a single message I'd have probably done
"git cherry-pick $commit && git commit --amend". For multiple I'd just
cherry-pick them all first, then follow-up with "git rebase -i".

-Peff

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

* Re: cherry-pick --message?
  2017-03-21 17:00 ` Jeff King
@ 2017-03-21 17:07   ` Andreas Krey
  2017-03-21 17:33     ` Jeff King
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Krey @ 2017-03-21 17:07 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Tue, 21 Mar 2017 13:00:05 +0000, Jeff King wrote:
...
> > I have an slightly unusual usecase for cherry-pick:
> > I want to modify the commit message that is used in the process,
> > e.g. do an d/^PROP:/ on it, but unfortunately -m does something
> > else here.
> > 
...
> 
> There's "cherry-pick --edit".

Yes, but. I'm in a toolchain, not a user. I'm a command that let
the user cherry-pick specific things, and I need to edit out the things
that made the original commit eligible to be picked in the first place.

Can't quite rely on the tool's user to do that. :-(

I'm not familiar with the plumbing to know where to look there.

- Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

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

* Re: cherry-pick --message?
  2017-03-21 17:07   ` Andreas Krey
@ 2017-03-21 17:33     ` Jeff King
  2017-03-28 11:30       ` UNS: " Andreas Krey
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff King @ 2017-03-21 17:33 UTC (permalink / raw)
  To: Andreas Krey; +Cc: git

On Tue, Mar 21, 2017 at 06:07:34PM +0100, Andreas Krey wrote:

> > There's "cherry-pick --edit".
> 
> Yes, but. I'm in a toolchain, not a user. I'm a command that let
> the user cherry-pick specific things, and I need to edit out the things
> that made the original commit eligible to be picked in the first place.
> 
> Can't quite rely on the tool's user to do that. :-(
> 
> I'm not familiar with the plumbing to know where to look there.

You can do:

  GIT_EDITOR='sed -i d/^PROP:/' git cherry-pick --edit

but if there's a conflict, the user has resume it with that environment
variable set. If you can rely on the user using your tool, that might
work. If they might run arbitrary git commands, then no.

Probably "format-patch | sed | am -3" is your best bet if you want to
modify the patches in transit _and_ have the user just use normal git
tools.

-Peff

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

* Re: UNS: Re: cherry-pick --message?
  2017-03-21 17:33     ` Jeff King
@ 2017-03-28 11:30       ` Andreas Krey
  2017-03-28 18:17         ` Jonathan Nieder
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Krey @ 2017-03-28 11:30 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Tue, 21 Mar 2017 13:33:35 +0000, Jeff King wrote:
...
> Probably "format-patch | sed | am -3" is your best bet if you want to
> modify the patches in transit _and_ have the user just use normal git
> tools.

Except that 'git am' doesn't have --no-commit like cherry-pick does. :-(
It's always something. (Perhaps I'm instead going to rewrite the commit
before cherry-picking it.)

- Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

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

* Re: UNS: Re: cherry-pick --message?
  2017-03-28 11:30       ` UNS: " Andreas Krey
@ 2017-03-28 18:17         ` Jonathan Nieder
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Nieder @ 2017-03-28 18:17 UTC (permalink / raw)
  To: Andreas Krey; +Cc: Jeff King, git

Andreas Krey wrote:
> On Tue, 21 Mar 2017 13:33:35 +0000, Jeff King wrote:

>> Probably "format-patch | sed | am -3" is your best bet if you want to
>> modify the patches in transit _and_ have the user just use normal git
>> tools.
>
> Except that 'git am' doesn't have --no-commit like cherry-pick does. :-(
> It's always something. (Perhaps I'm instead going to rewrite the commit
> before cherry-picking it.)

'git apply --index' can do that.  I agree that it would be sensible
for 'git am' to grow a --no-commit option to do that.

Thanks and hope that helps,
Jonathan

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

end of thread, other threads:[~2017-03-28 18:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 16:05 cherry-pick --message? Andreas Krey
2017-03-21 17:00 ` Jeff King
2017-03-21 17:07   ` Andreas Krey
2017-03-21 17:33     ` Jeff King
2017-03-28 11:30       ` UNS: " Andreas Krey
2017-03-28 18:17         ` Jonathan Nieder

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