3

我想防止 git push 和 pull 到所有远程分支。我知道开关 --all 并且我希望当我设置这个开关时 git 只会推送到 all 。

当我输入git remote show origin时,我看到我所有的本地分支都配置为 git pull 并推送到远程分支。

但我更喜欢它,当我输入git pull而没有origin branchname时,git 只会推送实际的分支。

是否有一个配置开关可以改变这种行为?

4

1 回答 1

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.

于 2013-03-24T12:56:09.507 回答