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

rebasing merges

From
Stephen Haberman <stephen@exigencecorp.com>
Date
Sep 22, 2008, 20:57 UTC
Message-ID
<20080922155749.c8070681.stephen@exigencecorp.com>
Hello,

I was wondering if there are any plans to enhance the rebase functionality to match something like [1], specifically to handle rebasing merge commits.

My understanding of the current rebase implementation is that it dumps all the changes as a patch, moves HEAD, and applies the patch.

This works great for regular commits, but if one of the new commits was a merge, rebase seems to "flatten" the merge. Because the patch dump doesn't include any information about the merged commit's existing hashes/parents, when the patch is applied, each merged commit gets reapplied as a new commit, with a new hash, and no DAG link back to where the original pre-rebase merge came from.

We've had this happen on topic branches when devs merged in a new stable release that contains ~100 commits, but had their branch's remote head move on them, so they pull --rebase as usual, but end up with all ~100 commits from the release essentially cherry-picked into their topic branch. So now we have the disclaimer of "usually pull --rebase...unless you've done a merge, then do a pull --merge".

[1] seems to solve this with some fairly complex cherry-picking and ancestry manipulation that, admittedly, I don't quite understand, but it seems like it might be able to bring along a merge's multiple parents information throughout the rebase and maintain the merge as a single, non-flattened merge commit.

Thanks, Stephen

1: http://www.selenic.com/mercurial/wiki/index.cgi/RebasePlan
Next: Stephen Haberman
Message 1 of 14 in “rebasing merges”
  1. Stephen HabermanSep 22, 2008
  2. Stephen HabermanSep 23, 2008
  3. Johannes SixtSep 23, 2008
  4. Samuel TardieuSep 23, 2008
  5. Johannes SixtSep 23, 2008
  6. Andreas EricssonSep 23, 2008
  7. Stephen HabermanSep 23, 2008
  8. Johannes SixtSep 23, 2008
  9. Andreas EricssonSep 23, 2008
  10. Stephen HabermanSep 23, 2008
  11. Andreas EricssonSep 23, 2008
  12. Stephen HabermanSep 23, 2008
  13. Stephen HabermanSep 23, 2008
  14. SZEDER GáborSep 23, 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.