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

Re: [PATCH/RFC] rebase -p: do not redo the merge, but cherry-pick first-parent changes

From
Junio C Hamano <gitster@pobox.com>
Date
May 24, 2012, 21:34 UTC
Message-ID
<7vaa0xw9dy.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4FBE9AC7.3010506@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 23 quoted lines
> Today I was able to use rebase -i -p in the field. I used it to rebuild
> an integration branch (akin to git's pu branch). Guess what? It did not
> work as expected:
>
> Two of the topic branches' early parts were already merged in the
> upstream. The instruction sheet had only 'pick' of merge commits for the
> topics. Except for these two; there, all commits (that were not yet in
> upstream) were offered to pick, including the merge commit.
>
> I started with this:
>
>     A--M--o--o   <- master
>    /  /
> --o--X--Y        <- side branch (partially merged in master)
>    \     \
>     R--S--N--T   <- integration (to be rebuilt on master)
>
> I wanted this:
>
>      A--M--o--o
>     /  /       \
>    /  /          R'--S'--N'--T'
> --o--X--Y---------------´

It is unclear what exact revisions you gave to rebase, but I am assuming that you asked "rebase --onto master X^ T" (you can use R^ instead of X^; they refer to the same commit).

It is straightforward to see what should happen to R and S; they should be a straight replay of single parent commit on top of 'master'.

But it is unclear what should happen to X and Y.

When you are rebasing the X^..T sub-DAG, can you say what makes S more special than Y by looking at the original topology? Your "I wanted this" picture depicts S' to be rewritten but Y stays the same. Why?

They are both in the X^..T DAG, and neither of them is merged to 'master'. I can sort of see why X and R would be treated differently (X is part of master, R is not), but I cannot justify why your "I wanted this" picture replays S' without replaying Y'.

What am I missing?
Show 5 quoted lines
> But I got this:
>
>     A--M--o--o-------Y'
>    /  /       \       \
> --o--X--Y      R'--S'--N'--T'

Which is what I would expect, from the "Y and S play a similar role in the sub-DAG X^..T in the original DAG, with respect to master" point of view.

Previous: Johannes SixtNext: Johannes Sixt
Message 12 of 16 in “rebase -p: do not redo the merge, but cherry-pick first-parent changes”
  1. rebase -p: do not redo the merge, but cherry-pick first-parent changesJohannes Sixt, May 21, 2012
  2. Junio C HamanoMay 22, 2012
  3. Johannes SixtMay 22, 2012
  4. Jonathan NiederMay 22, 2012
  5. Martin von ZweigbergkMay 23, 2012
  6. Junio C HamanoMay 23, 2012
  7. Martin von ZweigbergkMay 23, 2012
  8. Junio C HamanoMay 24, 2012
  9. Martin von ZweigbergkMay 24, 2012
  10. Junio C HamanoMay 24, 2012
  11. Johannes SixtMay 24, 2012
  12. Junio C HamanoMay 24, 2012
  13. Johannes SixtMay 25, 2012
  14. Junio C HamanoMay 25, 2012
  15. Johannes SixtMay 25, 2012
  16. Johannes SixtMay 23, 2012

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.