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

Re: Rebasing multiple branches at once

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 1, 2017, 02:40 UTC
Message-ID
<xmqqmvfb4i5a.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161231081433.3zo6lrsjsu2qho4u@glandium.org>
Mike Hommey <mh@glandium.org> writes:
Show 12 quoted lines
> So I now have:
>
> A---G
> \---B---C---D---E
>             \---F
>
> If I do the dumb thing, which is to do `git rebase master E` and `git
> rebase master F`, I end up with:
>
> A---G---B'---C'---D'---E'
>     \---B"---C"---D"---F'
>

What people seem to do is to teach the branch that ends with F that its upstream is the local branch that ends with E, so that they can be lazy when rebasing a branch that knows its upstream. I suspect that you would end up with

A---G---B'--C'--D'--E'--F'

instead if it is done naively, but if you really care that the branch that ends with F does not have E, you presumably want to have the branch that ends at D its own identity, so

 (1) 'master' or whatever that used to end at A and now its tip is
     at G;
 (2) the branch that ends at D whose upstream is 'master';
 (3) the branch that ends at E whose upstream is (2); and
 (4) the branch that ends at F whose upstream is (2).

I personally do not do that, though, because you'd need to remember the order in which these three branches must be rebased (i.e. (2) must be done first before rebasing (3) and (4) in any order).

Previous: Mike HommeyNext: Jeff King
Message 2 of 4 in “Rebasing multiple branches at once”
  1. Mike HommeyDec 31, 2016
  2. Junio C HamanoJan 1, 2017
  3. Jeff KingJan 2, 2017
  4. Johannes SixtJan 1, 2017

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.