16

I tried setting

git config --global pull.rebase false

and

git config pull.rebase false

and when I run

git config --global pull.rebase

or

git config pull.rebase

I see false, but when I run git pull ... it still is doing a rebase. How can I make this go away again?

peter
  • 14,348
  • 9
  • 62
  • 96

2 Answers2

25

The best way

Don't use git pull. Just run git fetch and then when it's done, run git merge.

(This is also the best way to do rebase pulls: don't use git pull. "This ... is wrong tool. Never use this.")

The other way

Use git pull --rebase=false. The command line flag overrides the configuration setting.

torek
  • 448,244
  • 59
  • 642
  • 775
  • 2
    Credit for the B5 link. But if it's '_wrong_' why does it exist? – geotheory Oct 21 '20 at 15:49
  • @geotheory: Some people like it, and think it's convenient. It predates the invention of the *upstream* setting, and back then—in 2006 or so—it was generally the way to do things. – torek Oct 21 '20 at 16:09
  • Confusing, as I understood upstream setting links a local branch to a remote branch so that simpler calls like `git pull` become unambiguous and so are enabled. – geotheory Oct 21 '20 at 19:18
  • @geotheory: Not exactly. The upstream of a branch is a pair of names: a remote name (or `.` to mean "self"), and a branch name as found on the Git specified by that remote name. That information then gets used *by* `git pull`. Before remotes existed, you always had to specify everything: `git pull `; the invention of remotes allowed shortening this to `git pull`, but it also allows running `git fetch` followed by a second Git command, without having to type in the `` and `` parts. So it used to be more convenient because you used to have to type in the branch twice. – torek Oct 21 '20 at 19:22
  • Before remotes existed, there were several attempts to allow one to not type in a full URL. Those still work, and are why `git fetch` and `git push` have that complicated documentation section describing how you can specify some other Git repository. The invention of the remote, like `origin`, allowed collapsing all of this down into two simple settings, which became the upstream. – torek Oct 21 '20 at 19:24
2

In addition to pull.rebase, this behavior can also be enabled using branch.<name>.rebase or branch.autoSetupRebase. To disable rebasing by default on git pull, you need to unset those on all levels of Git configuration (repo, user, system).

Eugene Yarmash
  • 142,882
  • 41
  • 325
  • 378