git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: one half of a rebase

From
Paolo Bonzini <bonzini@gnu.org>
Date
Sep 12, 2009, 14:38 UTC
Message-ID
<4AABB253.2080200@gnu.org>
In-Reply-To
<7f9d599f0909111923v76e0f411n16555e7cdc0c3ed1@mail.gmail.com>
On 09/12/2009 04:23 AM, Geoffrey Irving wrote:
Show 10 quoted lines
> On Fri, Sep 11, 2009 at 5:10 PM, Alex Riesen<raa.lkml@gmail.com>  wrote:
>> On Fri, Sep 11, 2009 at 19:25, Geoffrey Irving<irving@naml.us>  wrote:
>>> If I could do (2) as a separate operation, it would look something like
>>>
>>>     git cherry-pick-all topic
>>>
>>> which is simpler and faster since it avoids switching files back and
>>> forth (master to topic and back).  Is there a robust way to achieve
>>> the cherry-pick-all semantics with current commands?  If not, how
>>> difficult would it be to partition rebase accordingly?

As mentioned by Alex "git am -3" is basically parsing + the second part of rebase. So, based on Alex's recipe, here is a possible alias for cherry-pick-all:

[alias]
	cherry-pick-all = "!f() { git format-patch -k --stdout --full-index 
`git symbolic-ref HEAD`..$1 | git am -k -3 --binary; }; f"

More useful (just because it is more generic) than "the second part of git rebase", a "sequencer" would be "the second part of git rebase -i", applying a custom script coming from stdin. If that was present, git cherry-pick-all could be done like this:

git log --pretty=tformat:'pick %h' master..topic | git sequencer

And here is yet another alternative, that however would only work only if the patches applies perfectly:

git log --pretty=format:%h master..topic | xargs -rn1 git cherry-pick
Paolo
Previous: Geoffrey Irving
Message 5 of 5 in “one half of a rebase”
  1. Geoffrey IrvingSep 11, 2009
  2. Matthieu MoySep 11, 2009
  3. Alex RiesenSep 11, 2009
  4. Geoffrey IrvingSep 12, 2009
  5. Paolo BonziniSep 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.