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

Re: [PATCH] docs: Clarify what git-rebase's "--preserve-merges" does

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Mar 26, 2015, 20:28 UTC
Message-ID
<55146BF5.7040008@gmail.com>
In-Reply-To
<xmqqd23vzkon.fsf@gitster.dls.corp.google.com>
On 26.03.2015 19:18, Junio C Hamano wrote:
>> Also, do not say that merge commits are *tried* to be recreated.
>
> Good point.  "We will try but it might fail" is better left unsaid
> as that is true almost everywhere.
Exactly.
Show 7 quoted lines
>>   -p::
>>   --preserve-merges::
>> -    Instead of ignoring merges, try to recreate them.
>> +    Recreate merge commits instead of replaying commits a merge
>> commit introduces.
>
> Hmm, is this line-wrapped?
Probably, I had to send this via GMail.
Show 10 quoted lines
> Although I fully agree that the new text is better than the original,
> I think the new text fails to point out one major aspect by not
> mentioning "linear" or "flatten" anywhere.  The point of "git rebase"
> without "-p" is not just to replay but to flatten
>
> 	Instead of flattening the history by replaying each
> 	non-merge commit to be rebased, preserve the shape of the
> 	rebased history by recreating merge commits as well.
>
> or something along that line, perhaps?

Hm, I'm not sure about the "as well" here. Non-merge commits basically are just picked, not recreated in the same sense as merge commits. I'll come up with another proposal.

Show 9 quoted lines
> I think the current preserve-merges considers everything between
> <upstream> and <branch> as "commits to be rebased", and recreate
> merges across these rebased tips of branches that are merged.  There
> however were repeated wishes (or wishful misunderstandings ;-) that
> there were a mode to rebuild the trunk, considering only the commits
> on the first-parent chain as "commits to be rebased", recreating the
> history by replaying the merge commits (whose first parent might be
> rewritten during the rebase, but the tips of side branches these
> merges bring into the history are kept intact).

I guess I'm a victim of that wishful misunderstanding then, as I indeed though that's exactly what the current -p is doing. Well, modulo the special case where the second parent is the tip of a branch whose fork-point with the trunk is part of the rebase, see "Example 1" at [1].

In other word, you're saying that the current preserve-merges does not keep the tips of side branches intact. If that's so, what is is doing with the tips of the side branches?

Show 5 quoted lines
> without such a feature in the system, I would be happier if we made
> sure that the description we are discussing to update makes it clear
> that the current behaviour is "everything between <upstream> and
> <branch>", and cannot be misread as "do not touch side branches
> instead of dropping merged commits".
Agreed. As soon as I understand the difference between the two :-)
[1] http://stackoverflow.com/a/15915431/1127485
-- 
Sebastian Schuberth
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 19 in “docs: Clarify what git-rebase's "--preserve-merges" does”
  1. docs: Clarify what git-rebase's "--preserve-merges" doesSebastian Schuberth, Mar 26, 2015
  2. Junio C HamanoMar 26, 2015
  3. Sebastian SchuberthMar 26, 2015
  4. Junio C HamanoMar 26, 2015
  5. Sergey OrganovMar 26, 2015
  6. Johannes SixtMar 26, 2015
  7. Sergey OrganovMar 31, 2015
  8. Junio C HamanoMar 31, 2015
  9. Sergey OrganovMar 31, 2015
  10. Junio C HamanoMar 31, 2015
  11. Sergey OrganovApr 1, 2015
  12. Junio C HamanoApr 1, 2015
  13. Sergey OrganovApr 2, 2015
  14. Sebastian SchuberthMar 30, 2015
  15. Junio C HamanoMar 30, 2015
  16. Sebastian SchuberthMar 30, 2015
  17. Junio C HamanoMar 30, 2015
  18. Junio C HamanoMar 30, 2015
  19. Sebastian SchuberthMar 30, 2015

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.