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

Re: [PATCH] doc: pull: fix rebase=false documentation

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jul 23, 2021, 18:29 UTC
Message-ID
<60fb0a916c9cc_defb208eb@natae.notmuch>
In-Reply-To
<xmqqwnphowdx.fsf@gitster.g>
Junio C Hamano wrote:
Show 26 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > So I feel compelled to say now that I do not think that changing the
> > order of parents for "git pull" is the obviously correct thing to do.
> > And likewise, in the one thread I do remember participating in, I
> > expressed something similar:
> >
> >   https://lore.kernel.org/git/20140502214817.GA10801@sigill.intra.peff.net/
> 
> Thanks for the link.  Many articles in the thread are repeating the
> same opinion over and over (and later even descend into ad-hominem
> attacks) and it is not worth anybody's time to read all of them, but
> I found that there still were some gems.
> 
> In an worldview where the first-parent chain is the trunk history,
> merging in the upstream where you push back to into your working
> repository where your new work is happening as the second parent
> before pushing it back would obviously make the history that used to
> be trunk to lose the first-parent-ness at that point.  And if you
> ask if I just said is correct, everybody would say it is.  So there
> is a concensus that the result of "git pull upstream main" becomes
> a wrong shape for people in one workflow.
> 
> But that does not necessarily mean swapping the parent order would
> produce the history of a right shape, either, even for those with
> the "first-parent chain is the trunk" worldview.
Why not? Everyone who saw a problem agreed it would.
Reversing the order of the parents creates a merge commit like so:
  Y---X-+
         \
  B---A---M  trunk

Most git experts work with topic branches, and when you do that, you get the same thing:

    topic
      |
      v
  Y---X-+
         \
  B---A---M  master
If you merge topic to master, the first parent of the merge commit is A.

If you do `git pull --reverse-parents` on a trunk-based workflow as above, you would get exactly the same shape of the history.

How is it not the right shape?
-- 
Felipe Contreras
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 12 in “doc: pull: fix rebase=false documentation”
  1. doc: pull: fix rebase=false documentationFelipe Contreras, Jul 21, 2021
  2. Junio C HamanoJul 21, 2021
  3. Junio C HamanoJul 22, 2021
  4. Felipe ContrerasJul 22, 2021
  5. Jeff KingJul 23, 2021
  6. Philip OakleyJul 23, 2021
  7. Felipe ContrerasJul 23, 2021
  8. Junio C HamanoJul 23, 2021
  9. Felipe ContrerasJul 23, 2021
  10. Junio C HamanoJul 23, 2021
  11. Felipe ContrerasJul 24, 2021
  12. Felipe ContrerasJul 23, 2021

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.