{"thread":{"id":"45457","subject":"cherry-pick --message?","startedAt":"2017-03-21T16:41:11Z","lastAt":"2017-03-28T18:18:12Z","messageCount":6,"participants":["Andreas Krey","Jeff King","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"314817","messageId":"20170321160520.GA15550@inner.h.apk.li","threadId":"45457","inReplyTo":null,"subject":"cherry-pick --message?","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2017-03-21T16:05:20Z","receivedAt":"2017-03-21T16:41:11Z","isPatch":false,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"Hi all,\n\nI have an slightly unusual usecase for cherry-pick:\nI want to modify the commit message that is used in the process,\ne.g. do an d/^PROP:/ on it, but unfortunately -m does something\nelse here.\n\nAnd there is no --message here for good reason, as cherry-pick\ncan pick multiple commits and so on. Bad for me, though.\n\nSo, am I down to the combo of format-patch and apply, or is there\nan easier way? (I'd also like to end up in the same state as with\ncherry-pick should there be conflicts.)\n\n- Andreas\n\n-- \n\"Totally trivial. Famous last words.\"\nFrom: Linus Torvalds <torvalds@*.org>\nDate: Fri, 22 Jan 2010 07:29:21 -0800\n"},{"id":"314821","messageId":"20170321170005.35ryjh4pr3jvvmx3@sigill.intra.peff.net","threadId":"45457","inReplyTo":"20170321160520.GA15550@inner.h.apk.li","subject":"Re: cherry-pick --message?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-03-21T17:00:05Z","receivedAt":"2017-03-21T17:01:01Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 21, 2017 at 05:05:20PM +0100, Andreas Krey wrote:\n\n> Hi all,\n> \n> I have an slightly unusual usecase for cherry-pick:\n> I want to modify the commit message that is used in the process,\n> e.g. do an d/^PROP:/ on it, but unfortunately -m does something\n> else here.\n> \n> And there is no --message here for good reason, as cherry-pick\n> can pick multiple commits and so on. Bad for me, though.\n> \n> So, am I down to the combo of format-patch and apply, or is there\n> an easier way? (I'd also like to end up in the same state as with\n> cherry-pick should there be conflicts.)\n\nThere's \"cherry-pick --edit\".\n\nI had to look it up, though. For a single message I'd have probably done\n\"git cherry-pick $commit && git commit --amend\". For multiple I'd just\ncherry-pick them all first, then follow-up with \"git rebase -i\".\n\n-Peff\n"},{"id":"314822","messageId":"20170321170734.GI28331@inner.h.apk.li","threadId":"45457","inReplyTo":"20170321170005.35ryjh4pr3jvvmx3@sigill.intra.peff.net","subject":"Re: cherry-pick --message?","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2017-03-21T17:07:34Z","receivedAt":"2017-03-21T17:14:01Z","isPatch":false,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"On Tue, 21 Mar 2017 13:00:05 +0000, Jeff King wrote:\n...\n> > I have an slightly unusual usecase for cherry-pick:\n> > I want to modify the commit message that is used in the process,\n> > e.g. do an d/^PROP:/ on it, but unfortunately -m does something\n> > else here.\n> > \n...\n> \n> There's \"cherry-pick --edit\".\n\nYes, but. I'm in a toolchain, not a user. I'm a command that let\nthe user cherry-pick specific things, and I need to edit out the things\nthat made the original commit eligible to be picked in the first place.\n\nCan't quite rely on the tool's user to do that. :-(\n\nI'm not familiar with the plumbing to know where to look there.\n\n- Andreas\n\n-- \n\"Totally trivial. Famous last words.\"\nFrom: Linus Torvalds <torvalds@*.org>\nDate: Fri, 22 Jan 2010 07:29:21 -0800\n"},{"id":"314834","messageId":"20170321173335.n56veklbh4iginoa@sigill.intra.peff.net","threadId":"45457","inReplyTo":"20170321170734.GI28331@inner.h.apk.li","subject":"Re: cherry-pick --message?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-03-21T17:33:35Z","receivedAt":"2017-03-21T18:25:11Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 21, 2017 at 06:07:34PM +0100, Andreas Krey wrote:\n\n> > There's \"cherry-pick --edit\".\n> \n> Yes, but. I'm in a toolchain, not a user. I'm a command that let\n> the user cherry-pick specific things, and I need to edit out the things\n> that made the original commit eligible to be picked in the first place.\n> \n> Can't quite rely on the tool's user to do that. :-(\n> \n> I'm not familiar with the plumbing to know where to look there.\n\nYou can do:\n\n  GIT_EDITOR='sed -i d/^PROP:/' git cherry-pick --edit\n\nbut if there's a conflict, the user has resume it with that environment\nvariable set. If you can rely on the user using your tool, that might\nwork. If they might run arbitrary git commands, then no.\n\nProbably \"format-patch | sed | am -3\" is your best bet if you want to\nmodify the patches in transit _and_ have the user just use normal git\ntools.\n\n-Peff\n"},{"id":"315562","messageId":"20170328113055.GA5269@inner.h.apk.li","threadId":"45457","inReplyTo":"20170321173335.n56veklbh4iginoa@sigill.intra.peff.net","subject":"Re: UNS: Re: cherry-pick --message?","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2017-03-28T11:30:55Z","receivedAt":"2017-03-28T11:41:43Z","isPatch":false,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"On Tue, 21 Mar 2017 13:33:35 +0000, Jeff King wrote:\n...\n> Probably \"format-patch | sed | am -3\" is your best bet if you want to\n> modify the patches in transit _and_ have the user just use normal git\n> tools.\n\nExcept that 'git am' doesn't have --no-commit like cherry-pick does. :-(\nIt's always something. (Perhaps I'm instead going to rewrite the commit\nbefore cherry-picking it.)\n\n- Andreas\n\n-- \n\"Totally trivial. Famous last words.\"\nFrom: Linus Torvalds <torvalds@*.org>\nDate: Fri, 22 Jan 2010 07:29:21 -0800\n"},{"id":"315583","messageId":"20170328181709.GR31294@aiede.mtv.corp.google.com","threadId":"45457","inReplyTo":"20170328113055.GA5269@inner.h.apk.li","subject":"Re: UNS: Re: cherry-pick --message?","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-03-28T18:17:10Z","receivedAt":"2017-03-28T18:18:12Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Andreas Krey wrote:\n> On Tue, 21 Mar 2017 13:33:35 +0000, Jeff King wrote:\n\n>> Probably \"format-patch | sed | am -3\" is your best bet if you want to\n>> modify the patches in transit _and_ have the user just use normal git\n>> tools.\n>\n> Except that 'git am' doesn't have --no-commit like cherry-pick does. :-(\n> It's always something. (Perhaps I'm instead going to rewrite the commit\n> before cherry-picking it.)\n\n'git apply --index' can do that.  I agree that it would be sensible\nfor 'git am' to grow a --no-commit option to do that.\n\nThanks and hope that helps,\nJonathan\n"}]}