Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 838
Chris Maes Avatar asked Apr 14 '14 14:04

Chris Maes


People also ask

What is git Autosetuprebase?

autosetuprebase controls whether new branches should be set up to be rebased upon git pull , i.e. your setting of always will result in branches being set up such that git pull always performs a rebase, not a merge. (Be aware that existing branches retain their configuration when you change this option.)

What is git config pull ff only?

With git pull --ff-only , Git will update your branch only if it can be “fast-forwarded” without creating new commits.

Does git pull auto rebase?

Pull with RebaseThe default Git behavior is merging, which will create a new commit on your local branch that resolves those changes. This configuration switches that behavior to the rebasing strategy.

How do I rebase a master branch?

To rebase, make sure you have all the commits you want in the rebase in your master branch. Check out the branch you want to rebase and type git rebase master (where master is the branch you want to rebase on).


1 Answers

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.

like image 140
twalberg Avatar answered Sep 21 '22 13:09

twalberg