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

Re: Current state / standard advice for rebasing merges without information loss/re-entry?

From
Martin von Zweigbergk <martinvonz@gmail.com>
Date
Apr 19, 2022, 15:10 UTC
Message-ID
<CANiSa6i7iyVB4uoy1fF4EmorGFoDgYsf1zEO6F6UPeBSkSfjJA@mail.gmail.com>
In-Reply-To
<CAPMMpog-=m2e9mgFMvUhHKLPPboqP1gkg5GkHJF2tswjp+P-1g@mail.gmail.com>
On Tue, Apr 19, 2022 at 2:50 AM Tao Klerks <tao@klerks.biz> wrote:
Show 29 quoted lines
>
> On Tue, Apr 19, 2022 at 6:25 AM Martin von Zweigbergk
> <martinvonz@gmail.com> wrote:
> >
> > Consider this case:
> >
> >   X
> >  /
> > A---B---C
> >  \       \
> >   D---E---F
> >
> > If you now want to rebase E onto X, and then F onto E' and C, then
> > Elijah's suggestion (and what my VCS does) will work correctly. If I
> > understood Sergey's proposal, on the other hand, the utility merge
> > would bring in the changes from D as well. Or, put another way, that
> > algorithm is only useful for rebasing "internal" merges, where the
> > merge commit is being rebased along with both (all of) its legs
> > (again, if I understood it correctly).
> >
>
> FWIW, I don't believe this to be the case. If you rebase E onto X, the
> way the "D side" of the merge will be resolved, on X, will be as a
> combination of "Addition of X" and "Removal of D" onto the previous E
> commit state. The secret sauce in Sergey's approach is the application
> of a patch representing the "inverted change" to the "D arm" of the
> merge base in the original merge vs the "new D arm" (which  happens to
> no longer contain D and have X instead - I just have no better way to
> refer to it).

I see, it applies a reversed D onto E before creating the utility merges. That makes sense.

Show 7 quoted lines
> I haven't understood or explored Elijah's suggestion (or your
> implementation), but based on your description, it sounds like they
> end up being equivalent in result, but maybe present any conflicts
> differently (as a different patch applying to a different base). I
> expect cleanly rebased merges to come out the same, and the same
> situations/scenarios to lead to clean merges vs conflicts, but the
> presentation of conflicts to likely look different.

Yes, pretty much. I expect there would be some minor differences but I can't think of an example.

Previous: Tao Klerks
Message 14 of 14 in “Current state / standard advice for rebasing merges without information loss/re-entry?”
  1. Tao KlerksApr 18, 2022
  2. Philip OakleyApr 18, 2022
  3. Junio C HamanoApr 18, 2022
  4. Philip OakleyApr 18, 2022
  5. Junio C HamanoApr 18, 2022
  6. Martin von ZweigbergkApr 19, 2022
  7. Junio C HamanoApr 20, 2022
  8. Martin von ZweigbergkApr 20, 2022
  9. Sergey OrganovApr 18, 2022
  10. Martin von ZweigbergkApr 19, 2022
  11. Sergey OrganovApr 19, 2022
  12. Martin von ZweigbergkApr 19, 2022
  13. Tao KlerksApr 19, 2022
  14. Martin von ZweigbergkApr 19, 2022

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.