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

Re: git rebase to move a batch of patches onto the current branch

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Jul 25, 2008, 20:31 UTC
Message-ID
<20080725203118.GA28937@atjola.homenet>
In-Reply-To
<32541b130807241257j7820a591if8ca01c66bbcd6b2@mail.gmail.com>
On 2008.07.24 15:57:03 -0400, Avery Pennarun wrote:
Show 25 quoted lines
> Hi,
> 
> I often find myself being on a branch and wanting to do the equivalent
> of a series of cherry-picks from another branch into the current one.
> Unfortunately, "git cherry-pick" only does one patch at a time (which
> is very tedious), and "git rebase", which is much less tedious to use,
> seems to specializing in applying your current branch on top of
> another branch, not the other way around.
> 
> Currently I do something like this:
> 
>       git checkout -b tmp branch_with_interesting_stuff~5
>       git rebase --onto mybranch branch_with_interesting_stuff~15
>       git branch -d mybranch
>       git branch -m tmp mybranch
> 
> But it seems a little complex when what I *really* want to type is
> something like:
> 
>       git cherry-pick
> branch_with_interesting_stuff~15..branch_with_interesting_stuff~5
> 
> and have it give me a rebase-style UI in case of conflicts, etc.  And
> of course, even more bonus points if I can get "rebase -i"
> functionality.
For "rebase -i", this should do:

git checkout mybranch git reset --hard interesting_stuff~5 git rebase -i --onto ORIG_HEAD interesting_stuff~5

Not as nice as the format-patch thing but at least it doesn't drop your braches' reflog like your version, and it provides "rebase -i" functionality.

Note that the ORIG_HEAD thing might require a recent git version, IIRC there were some patches to make rebase correctly handle that.

Björn
Previous: Alex Riesen
Message 9 of 9 in “git rebase to move a batch of patches onto the current branch”
  1. Avery PennarunJul 24, 2008
  2. Alex RiesenJul 24, 2008
  3. Avery PennarunJul 24, 2008
  4. Alex RiesenJul 24, 2008
  5. Avery PennarunJul 24, 2008
  6. Daniel BarkalowJul 25, 2008
  7. Stephan BeyerJul 25, 2008
  8. Alex RiesenJul 25, 2008
  9. Björn SteinbrinkJul 25, 2008

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.