Chris Maes
Chris Maes

Reputation: 37732

git autosetuprebase is not working?

I have set up git with

git config --global branch.autosetuprebase always

and it looks ok in my ~/.gitconfigfile:

[branch]
    autosetuprebase = always

Yet when I do

git pull

he performs a merge (I removed company specific data):

From gitlab:***/***
    8fd1d96..0d064a3  master     -> origin/master
 * [new tag]         *** -> ***
Merge made by the 'recursive' strategy.

Why doesn't he perform rebase? Note that the only thing he pulled from remote was a tag and a minor code change in a file not changed locally...

edit: I have git version 1.8.4.5

edit: this is my local .git/config file:

[core]
        repositoryformatversion = 0
        filemode = true
        logallrefupdates = true
[branch "master"]
[remote "origin"]
        url = git@gitlab:***/***.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

Upvotes: 8

Views: 2520

Answers (1)

twalberg
twalberg

Reputation: 62379

The branch.autosetuprebase option in git only affects branches created after it is set. From the manual page (git help config):

  branch.autosetuprebase
       When a new branch is created with git branch or git checkout that tracks another branch, this variable
       tells Git to set up pull to rebase instead of merge (see "branch.<name>.rebase"). When never, rebase is ...

For branches that already exist, e.g. master, there is git config branch.master.rebase true, which can be scripted for multiple branches/repos if necessary.

Upvotes: 11

Related Questions