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

RE: [PATCH RFC] rebase: respect --ff-only option

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jul 5, 2021, 12:00 UTC
Message-ID
<60e2f44749749_1b8e782081f@natae.notmuch>
In-Reply-To
<20210705044505.666977-1-alexhenrie24@gmail.com>
Alex Henrie wrote:
> The warning about pulling without specifying how to reconcile divergent
> branches says that after setting pull.rebase to true, --ff-only can
> still be passed on the command line to require a fast-forward. Make that
> actually work.

I don't see any value in doing `git rebase --ff-only`. What is the difference with `git merge --ff-only`?

Presumably this isn't meant to to be called directly by the user, but only by `git pull`, so it's trying to address my comment [1]:

  > You can also pass --rebase, --no-rebase, or --ff-only on the command
  > line to override the configured default per invocation.
  Can I?
    git -c pull.rebase=true pull --ff-only
  `--ff-only` doesn't seem to be overriding the configuration.

Passing --ff-only to `git rebase` doesn't solve the problem I was pointing out, only half of it.

Sure, now this works:
  git -c pull.rebase=true pull --ff-only

But --ff-only is not really overriding anything, now you are passing the problem along.

Consider it the other way around:
  git -c pull.ff=only pull --rebase
Is --rebase overriding anything?
No, now all these three fail:
  git -c pull.ff=only pull
  git -c pull.ff=only pull --rebase
  git -c pull.ff=only pull --merge
This is making the situation even worse.

Junio already made the same mistake [2], and I already pointed out why that doesn't work [3].

This is what we want:
  1. git pull # fail by default unless it's a fast-forward
  2. git pull --merge # force a merge (unless it's a fast-forward)
  3. git pull --rebase # force a rebase (unless it's a fast-forward)

If you make `git rebase` honor --ff-only, and you make --ff-only the default, then `git pull --rebase` will *always* fail (unless it's a fast-forward).

We want this:
  git -c pull.ff=only pull --rebase
To *ignore* pull.ff=only, not honor it.

I already explored all the options, which is why I maintain that the only reasonable option is an orthogonal configuration:

  pull.mode=fast-forward
Cheers.

[1] https://lore.kernel.org/git/60d7faaf5311a_b8dfe208bd@natae.notmuch/ [2] https://lore.kernel.org/git/xmqqy2irjy4f.fsf@gitster.c.googlers.com/ [3] https://lore.kernel.org/git/CAMP44s08mEyYqbjOeTeS46CngrbQMqP2=cMr1dtRLLk_BLAq3w@mail.gmail.com/

-- 
Felipe Contreras
Previous: Ævar Arnfjörð Bjarmason
Message 15 of 15 in “rebase: respect --ff-only option”
  1. rebase: respect --ff-only optionAlex Henrie, Jul 5, 2021
  2. Phillip WoodJul 5, 2021
  3. Junio C HamanoJul 5, 2021
  4. Felipe ContrerasJul 5, 2021
  5. Phillip WoodJul 5, 2021
  6. Felipe ContrerasJul 7, 2021
  7. Phillip WoodJul 5, 2021
  8. Junio C HamanoJul 5, 2021
  9. Junio C HamanoJul 5, 2021
  10. Alex HenrieJul 5, 2021
  11. Ævar Arnfjörð BjarmasonJul 6, 2021
  12. Phillip WoodJul 6, 2021
  13. Felipe ContrerasJul 7, 2021
  14. Ævar Arnfjörð BjarmasonJul 5, 2021
  15. Felipe ContrerasJul 5, 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.