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

Re: [RFC 2/2] pull: default pull.ff to "only" when pull.rebase is not set either

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Dec 3, 2020, 23:05 UTC
Message-ID
<CAMP44s0K48xJy0gD6jLoiDr9GYDmD3MVmWYVbsNyXyBnPcvj1Q@mail.gmail.com>
In-Reply-To
<xmqqmtyuhemi.fsf@gitster.c.googlers.com>
On Thu, Dec 3, 2020 at 1:30 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
>
> Junio C Hamano <gitster@pobox.com> writes:
>
> >> That would require changing the semantics of --ff-only, so that "git
> >> pull --no-rebase --ff-only" doesn't make sense (as --ff-only is
> >> overridden by --no-rebase).
> >
> > I do not think such a conclusion follows from "we do not want to use
> > the 'by default force the --ff-only' when the user chooses between
> > merge and rebase".  Specifically, I do not agree with "as --ff-only
> > is overridden" in your statement.
>
> Ah, sorry, I mis-read your three lines above.
>
> There are currently two ways "git pull" consolidates your work with
> the other history.  By default, you are "pulling" work from your
> contributors (and that is what "pull request" means---contributors
> ask you to pull, and you take their work at your discretion) and the
> only way that makes sense is to merge their history into yours.

And this is the reason why I warn about using one's worldview too much. The *vast* majority of users do not use "git pull" this way; there are more contributors than maintainers.

What they want is to "merge your history into theirs", not the other way around. So the only way they can do that correctly is by doing "git fetch" + "git merge". Which is why so many people say to avoid "git pull" altogether.

So, a newcomer that doesn't know much about git and does a "git pull", is pretty much guaranteed to do something unintended. If he/she is a user, the merge will have the parents the other way around, but even as a maintainer, the project might not like merges, and he/she will introduce an unwanted merge, or worse; an evil merge.

> The other is you are updating your branch by rebasing your work on
> top of what happend in their history.

Again, what the user might want is the opposite. If the user is a maintainer, these two:

  git pull --merge github john
  git pull --rebase github john
Should be about their history to yours (or on top of yours).
Show 7 quoted lines
> And if we introduce a third-way, i.e. "we do not handle the case
> where you have your own development at all, this is only to maintain
> pristine copy from your upstream", and repurpose "--ff-only" for
> that purpose, yes, what you said above does make sense.  At that
> point, there is no reason to disagree with "as --ff-only is
> overridden" part of your statement---in your new world, "--ff-only"
> is redesigned to act that way.

That's right. Otherwise "git pull --no-rebase" will fail; you will have to specify --ff (or --no-ff) for it to work. And that doesn't make sense to me.

Specifying --no-rebase should override the default --ff-only mode (or pull.mode=ff-only).

Show 13 quoted lines
> In retrospect, "git pull --rebase" was a UI mistake.  What the other
> side means is totally different in the operation from what the other
> side is in "git pull".  The former is for you to catch up with your
> upstream and the latter is for you, who _is_ the upstream to others,
> to take others work in as their upstream.  If we instead introduced
> a separate command, say "git update", that is "fetch followed by
> rebase" (just like "git pull" is "fetch followed by merge"), to
> rebase your work on top of updated upstream, there wouldn't be a
> need for us to be having this discussion.
>
> It probably is water under the bridge at this point.  Perhaps if
> somebody builds a time-machine for me, I'll go back 13 years and
> give my younger self this wisdom ;-)

You don't have to go back 13 years ago, you can go back 6 years ago when I wrote all the patches for git update [1], explained the summary of the problem [2], and others urged git developers to pay more attention to the patch [3].

But as you say; water under the bridge.
Today there are 3 things to do:
1. Improve the annoying warning
2. Consider changing the semantics of --ff-only, or implement pull.mode=ff-only
3. Consider a new "git update" command

Since my new (2020) patches for pull.mode (solve 1 and 2) have not been reviewed, I'm thinking there's too much inertia and perhaps it's time to cash in the chips and concentrate only on 1.

Cheers.

[1] https://github.com/felipec/git/commit/d38f1641fc33535aa3c92cf6d3a30334324d3488 [2] https://lore.kernel.org/git/5366db742d494_18f9e4b308aa@nysa.notmuch/ [3] https://lore.kernel.org/git/CAGK7Mr4uucBN=17ph5pBjrz7yP60By1sERU9oBL+c2-gsMDmrw@mail.gmail.com/

-- 
Felipe Contreras
Previous: Junio C HamanoNext: Jacob Keller
Message 11 of 18 in “[RFC 1/2] pull: warn that pulling will not merge by default in Git 3.0”
  1. Alex HenrieNov 25, 2020
  2. 2/2 pull: default pull.ff to "only" when pull.rebase is not set eitherAlex Henrie, Nov 25, 2020
  3. Felipe ContrerasNov 25, 2020
  4. Felipe ContrerasNov 25, 2020
  5. Philip OakleyNov 25, 2020
  6. Felipe ContrerasDec 2, 2020
  7. Junio C HamanoDec 3, 2020
  8. Felipe ContrerasDec 3, 2020
  9. Junio C HamanoDec 3, 2020
  10. Junio C HamanoDec 3, 2020
  11. Felipe ContrerasDec 3, 2020
  12. Jacob KellerDec 4, 2020
  13. Junio C HamanoDec 4, 2020
  14. Felipe ContrerasDec 4, 2020
  15. Junio C HamanoDec 4, 2020
  16. Felipe ContrerasDec 4, 2020
  17. Alex HenrieDec 11, 2020
  18. Felipe ContrerasDec 12, 2020

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.