3

I would like to prevent that git push and pull to all remote branches. I know the switch --all and I would expected that git will only pushes to all when I set this switch.

When I enter git remote show origin than I see that all my local branches are configured for git pull and push to the remote branch.

But I would prefer it, that git will only pushes the actual branch when I enter git pull without origin branchname.

Is there a config switch with that I can change this behavior?

Jan Baer
  • 915
  • 1
  • 11
  • 15

1 Answers1

4

Considering the new default push policy, you can try and set:

git config push.default upstream
# or
git config push.default simple
# or
git config push.default current

All three are only for pushing the current branch.

As I explain in "git - push current vs. push upstream (tracking)":

Pushing only one branch (with the mode "simple", "current" or "upstream") avoids the scenario where all matching branches are pushed ("default "matching"), even though some of the branches are not ready to be pushed.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283