1

Basically the same situation as Error "Fatal: Not possible to fast-forward, aborting" :

$ git pull
fatal: Not possible to fast-forward, aborting.

and its answer solved the problem:

$ git pull --rebase
Successfully rebased and updated refs/heads/master.

However, the question is on the next line:

To set this option globally, use git config --global pull.rebase true

I've already done that, both globally and locally:

$ git config --global pull.rebase
true

$ git config pull.rebase
true

But why I still need the --rebase when doing git pull?

There is also one answer there saying to turn rebase = false, which I totally don't understand. Here is my sistuation:

$ grep -1 rebase ~/.gitconfig
[pull]
        rebase = true
        ff = only

How not to use the --rebase when doing git pull?

xpt
  • 20,363
  • 37
  • 127
  • 216
  • I'm a little confused. What are you trying to do exactly? Do you want to pull with a fast-forward-merge and git isn't letting you or do you want git to do a rebase when pulling? – vatbub Mar 23 '23 at 18:11
  • I want to config git to do a rebase by default when pulling, based on your question @vatbub, as I don't know if there are other options exist or not, or whether what you asked have to be mutually exclusive. What's in my ~/.gitconfig file is what accumulated throughout the years, from various suggestions. – xpt Mar 23 '23 at 19:48

1 Answers1

0

But why I still need the --rebase when doing git pull?

You should not.
But I usually combine that setting with git config --global rebase.autoStash true

That way, the working tree is clear, ready for the rebase.

Make sure you have a recent enough Git for that (2.27+ for rebase+autoStash).

Note: the pull.ff is not needed in that case, since you are rebasing on pull.

git config --global --unset pull.ff
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I do have `git config --global rebase.autoStash true` and I did _have to_ use --rebase when doing git pull. Do you have `ff = only` in you `~/.gitconfig` file? – xpt Mar 24 '23 at 04:20
  • @xpt I do not, that would be incompatible with the rebase option and is needed only when you do a regular pull with merge. I have edited the answer accordingly. – VonC Mar 24 '23 at 06:50