tnoiug
Last Updated: June 24, 2016
·
39.97K
· sickill
Sickill avatar 2016 bw

Rebase by default when doing git pull

git

If you want git to do a rebase instead of a merge when pulling you can run git pull like this:

git pull --rebase

Instead of typing the above (or making an alias for it), you can tell git to automatically rebase when pulling.

In git >= 1.7.9:

git config --global pull.rebase true

In git < 1.7.9:

git config --global branch.autosetuprebase always

The latter has the effect of automatically adding branch.<name>.rebase true for each checked out local branch that is tracking an upstream branch to the repository config file.

Note that if you have both options set (not really recommended) then branch.<name>.rebase true that is automatically added for each branch takes precedence over global pull.rebase true.

4 Responses
Add your response

6059
01e524cc2a4c9ee03a4cf982d6683adf

Would you mind explaining the benefit of the rebase? Just to keep the commit log cleaner?

over 1 year ago ·
6064
Sickill avatar 2016 bw

ready4god2513: here's a nice write-up on the topic: http://mislav.uniqpath.com/2013/02/merge-vs-rebase/

over 1 year ago ·
26480
None

Hmm, why --global? You might not want to let this affect your work in all repos.

12 months ago ·
27802

There's another reason to always do rebasing pulls --- to avoid foxtrot merges! http://bit-booster.blogspot.ca/2016/02/no-foxtrots-allowed.html

7 months ago ·