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

Re: git rebase --preserve-merges seems to not work

From
Joshua Jensen <jjensen@workspacewhiz.com>
Date
Sep 9, 2010, 06:26 UTC
Message-ID
<4C887E22.5050303@workspacewhiz.com>
In-Reply-To
<20100909055104.GA21004@atjola.homenet>
  ----- Original Message -----
From: Björn Steinbrink
Date: 9/8/2010 11:51 PM
Show 24 quoted lines
>> $ git lg --all
>> * 2c93a8a - (HEAD) c (11 seconds ago)
>> * 2b98bc6 - b (11 seconds ago)
>> * 6abf527 - (d) d (3 minutes ago)
>> | *   472fd93 - (bc-merge) Merge commit 'c' into HEAD (74 seconds ago)
>> | |\
>> |/ /
>> | * d132c87 - (c) c (3 minutes ago)
>> | * 4a88fd1 - b (3 minutes ago)
>> |/
>> * b576660 - (a, master) a (4 minutes ago)
> What you actually wanted to replay is just the first-parent history,
> redoing the merges with their respective original second parent.
> Jonathan (Cc'ed) had the same problem about a month ago.
>
> The "first parent" thing isn't that well defined, criss-cross merges
> combined with some unfortunate fast-forwards will easily make the
> first-parent history become the one that you didn't mean (ask any
> git-svn users that dared to use "git merge" without fully understanding
> how git-svn uses the history ;-)), but it works in this special case.
> And with that special case in mind (and admittedly probably not thinking
> much further) I came up with this patch a few years ago:
>
> http://marc.info/?l=git&m=119379735525213&w=2

I hand merged your change in to my Git installation. There is one part of git-rebase--interactive that looks entirely different, so I would need to look back through the history to determine how to properly apply it.

The good news is the patch does exactly what I want in this simple case. I will have to try it on some more complicated hierarchies to see what the end result is.

It's curious... whenever I ask around about issue X or feature Y, a previously submitted patch can generally be found in the list archives. :)

Josh
Previous: Björn Steinbrink
Message 3 of 3 in “git rebase --preserve-merges seems to not work”
  1. Joshua JensenSep 9, 2010
  2. Björn SteinbrinkSep 9, 2010
  3. Joshua JensenSep 9, 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.