1

I have added this: git config --global pull.default current

But when I do git pull I get all the branches from the origin remote. How can I make the default to work for git pull?

Hommer Smith
  • 26,772
  • 56
  • 167
  • 296
  • 1
    Is `pull.default` a valid configuration option? As far as I know, there is only `push.default`. – hsirah Dec 21 '15 at 23:38
  • 1
    Given that `git pull` is just `git fetch` followed by `git merge` or `git rebase`, what exactly do you expect for `pull.default` to affect? (There is no `pull.default` configuration item but there may be something that will do what you wanted.) – torek Dec 21 '15 at 23:45

1 Answers1

2

If you want to fetch only the current branch, you need to specify it, since there is no pull.default policy (only push policies).
If your branch has an upstream branch

git fetch $(git rev-parse --symbolic-full-name --abbrev-ref @{upstream} | sed 's!/! !')

Note that git pull already pull (meaning merge) only the current branch (but fetches and then update all remote tracking branches)

You could also change the refspec of the origin to always fetch one branch, but that would not be the "current" one.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250