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

Re: pull.rebase config vs. --ff-only on command line

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jul 19, 2021, 17:43 UTC
Message-ID
<60f5b9a9e29d8_13f2e22084b@natae.notmuch>
In-Reply-To
<fa757764-db25-849d-d8d5-e28908059f6b@aixigo.com>
Matthias Baumgarten wrote:
Show 49 quoted lines
> On 7/16/21 8:00 PM, Felipe Contreras wrote:
> > Matthias Baumgarten wrote:
> >> On 7/16/21 6:44 PM, Felipe Contreras wrote:
> >>> Elijah Newren wrote:
> >>>> On Fri, Jul 16, 2021 at 7:52 AM Matthias Baumgarten
> >>>> <matthias.baumgarten@aixigo.com> wrote:
> >>>>> this is my first time contacting you guys and girls so I hope this mail
> >>>>> achieves the expected standard. I've discovered the following behaviour
> >>>>> of git:
> >>>>>
> >>>>> If pull.rebase is configured to true and git pull --ff-only is executed
> >>>>> it seems like the config wins, i.e. issuing "Successfully rebased and
> >>>>> updated refs/heads/...", which is not what I would expect. I always
> >>>>> believed that command line options would overwrite configured options.
> >>>>>
> >>>>> Is my assumption that command line options always win wrong or is this a
> >>>>> bug?
> >>>>
> >>>> It's a bug.
> >>>
> >>> No it isn't.
> >>>
> >>> Elijah is elevating to fact his opinion of what --ff-only should be
> >>> changed to.
> >>>
> >>> But it has not been changed. Today --ff-only is meant only for the merge
> >>> mode of `git pull`, and like other merge-only options (e.g. --ff,
> >>> --no-ff, and --squash) it's ignored in the rebase mode.
> >>
> >> Shouldn't every explicitly given merge option (like --ff-only) overwrite
> >> any configured option that would not even result in a merge, i.e.
> >> forcing a merge and thus forcing ff-only?
> > 
> > Perhaps. Other developers have suggested that before.
> > 
> > The problem is that everyone wants to make --ff-only the default, and
> > then we start to get into a tricky situation, because what should these
> > do:
> > 
> >    git -c pull.ff=only pull
> >    git -c pull.ff=only pull --merge
> >    git -c pull.ff=only pull --rebase
> 
> If my assumption were true, and every explicit (cli given) option would 
> overwrite implicitly given ones (i.e. configured options), wouldn't
> 
>   * git -c pull.ff=only pull, do a fast-forward (or merge)
>   * git -c pull.ff=only pull --merge, force a merge commit
>   * git -c pull.ff=only pull --rebase, force rebase

The documentation says --ff-only is meant for merges, therefore these three should be valid and do the same:

  git pull --ff-only # --merge is the default
  git pull --merge --ff-only
  git pull --ff-only --merge

In order for your assumption above to be correct, the semantics of --ff-only have to be changed (along with the documentation), but people are *already* relying on the current semantics:

  [pull]
    ff = only
    rebase = true

I made a poll on reddit [1], and 19% (so far) said they do use both configurations, and they know what `git pull --no-rebase` would do.

In other words: they would expect `git pull` to do a rebase, but `git pull --merge` to do a fast-forward merge.

Changing the semantics of --ff-only would break behavior they rely on, unless we break symmetry from --ff-only and pull.ff=only which would be very hard to explain the documentation.

However, if --ff-only wasn't mapped to pull.ff=only, but pull.mode=fast-forward, then we can have both: the configurations people rely on today wouldn't be broken, and your expectation that `git pull --ff-only` overrides pull.mode=rebase would be met.

It's the perfect solution.
> > One of these will always fail, when it shouldn't
> Would this even apply under the above assumption?
[I think you meant to paste this]

Under your assumption it wouldn't fail, but other behavior users rely on today would be broken.

> > I proposed a solution for that, but is has been ignored.
> I'm sorry!

It's not me the one that suffers (I don't even use `git pull`), it's the users that have been negatively affected for more than ten years.

[1] https://www.reddit.com/r/git/comments/omcngl/do_you_use_both_pullff_and_pullrebase/
-- 
Felipe Contreras
Previous: Matthias BaumgartenNext: Junio C Hamano
Message 7 of 11 in “pull.rebase config vs. --ff-only on command line”
  1. Matthias BaumgartenJul 16, 2021
  2. Elijah NewrenJul 16, 2021
  3. Felipe ContrerasJul 16, 2021
  4. Matthias BaumgartenJul 16, 2021
  5. Felipe ContrerasJul 16, 2021
  6. Matthias BaumgartenJul 19, 2021
  7. Felipe ContrerasJul 19, 2021
  8. Junio C HamanoJul 22, 2021
  9. Felipe ContrerasJul 22, 2021
  10. Matthias BaumgartenJul 23, 2021
  11. Felipe ContrerasJul 16, 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.