I have set up git with
git config --global branch.autosetuprebase always
and it looks ok in my ~/.gitconfig
file:
[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
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.)
With git pull --ff-only , Git will update your branch only if it can be “fast-forwarded” without creating new commits.
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.
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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With