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

Rebasing a merged branch

From
Peter Krefting <peter@softwolves.pp.se>
Date
Jul 8, 2010, 11:52 UTC
Message-ID
<alpine.DEB.2.00.1007081247410.18908@ds9.cixit.se>
Hi!

If I slightly modify the example from the git-rebase manual page to look like this:

   o---o---o---o  master
          \
           o---o---o---o---o  topicA
            \     /
             A---B---C---D  topicB

(topicA has merged "B" into its history; its first-parent from the line of "o"s).

If I now do a "git rebase --onto master topicA topicB", I only get commit C and D, as it sees A and B as being part of both branches.

Is there a way to make git rebase pick up A, B, C and D (and only them)?

I.e., I would like "all commits on topicB which are not in topicA's --first-parent history".

I eventually came up with
   git rebase --onto master $(git rev-list topicA ^topicB | tail -1) topicB
but am thinking that it ought to be expressable in a simpler way?
-- 
\\// Peter - http://www.softwolves.pp.se/
Next: Chris Frey
Message 1 of 3 in “Rebasing a merged branch”
  1. Peter KreftingJul 8, 2010
  2. Chris FreyJul 10, 2010
  3. Peter BaumannJul 10, 2010

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.