4

I am using the method I found to pull --rebase by default when doing git pull:

Now I want to make the 'git pull' - by default pull only the current branch: How do you get git to always pull from a specific branch?. However this answer does not work when git is configured to rebase by default.

Is there a way to make git pull always rebase and pull only current branch?

Community
  • 1
  • 1
mbdev
  • 6,343
  • 14
  • 46
  • 63
  • Related: [How to make Git pull use rebase by default for all clones?](http://stackoverflow.com/q/13846300/456814). –  May 23 '14 at 19:03

1 Answers1

4

Considering this answer mentions:

if you have branch.autosetuprebase = always then it will also add:

rebase = true

You can, after doing git branch --set-upstream master origin/master, configure the rebase attribute of your branch:

git config branch.master.rebase false
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Ah, I did not see that. Thanks! – mbdev Jul 12 '12 at 14:41
  • Why would I do "git config branch.master.rebase false"? that would set the rebase flag to false in the .git/config – mbdev Jul 12 '12 at 17:07
  • @mbdev to avoid git rebasing by default after a `git pull`. – VonC Jul 12 '12 at 17:25
  • oh, we have a rebase policy so I would like it to --rebase the git pull – mbdev Jul 12 '12 at 18:26
  • @mbdev in that case, the `git branch --set-upstream master origin/master` is enough: any `git pull` from your branch will still fetch the upstream branch. (and then rebase your branch on top of it) – VonC Jul 12 '12 at 19:50