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 30, 2015, 19:42 UTC
Message-ID
<CAHGBnuP0mRYWyJiLvWHuqsVxMRPPtvu-QuWmcD8xXeVOXhwSDA@mail.gmail.com>
In-Reply-To
<xmqqfv8mxuuv.fsf@gitster.dls.corp.google.com>
On Mon, Mar 30, 2015 at 7:23 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
>> Ignoring a merge sounds like ignoring the changes a merge commit
>> introduces altogether, as if the merge commit was skipped or dropped from
>> history. But that is not what happens if "-p" is not specified.
>
> Every time I read the above (which is essentially the same from your
> first edition I think) I find the "ignoring the changes a merge
> commit introduces altogether" and "as if the merge commit was
> skipped" somehow contradicting with each other.  If the latter were
> "as if the side branch that was merged was skipped or dropped", I do
> not see the room for such a misinterpretation.
>
> That is, at least to me,
>
>          D---E---F
>         /         \
>     ---A---B---C---G---H
>
> the former, i.e. "the changes the merge G introdues", is "diff C G",

To me, too. In other words, this is the combined diff of all commits reachable from all parents of the merge (other than the first parent). In your example, that would be the combined diff of D, E and F, which equals "git diff C G".

However, I'm used to thinking that a non-conflicting merge itself has no diff, but introduces commits that have diffs. This way of seeing it probably comes from my intensive use of gitk which does not display a diff when selecting a merge commit unless it has conflicts resolved.

> while "merge commit was skipped" would mean a history like this:
>
>     ---A---B---C---D'--E'--F'--H'
>

This is where your interpretation differs. If a merge commit was skipped, it is non-existent. If it is non-existent, it also has no parents. If it has no parents, there are no commits that D, E, F could be replayed on to of C. Thus for me, skipping merge commit G in your example would result in:

    ---A---B---C---H'
Show 5 quoted lines
> And I think with "as if the side branch that was merged was
> dropped", this misinterpretation will become impossible.  It can
> only mean this history:
>
>     ---A---B---C---.---H'

I think we need to generalize the wording a bit for merges with more than two parents. How about making the the first paragraph of the commit message simply read:

Ignoring a merge sounds like dropping the merge commit and all side branches it merges from history. But that is not what happens if "-p" is not specified.

-- 
Sebastian Schuberth
Previous: Junio C HamanoNext: Junio C Hamano
Message 16 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.