防止该git推到所有分支 [英] Prevent that git pushes to all branches
问题描述
我想阻止那个git推送到所有远程分支。我知道开关 - 所有,我会希望只有当我设置这个开关时,git才会推向所有人。
当我输入 git remote show origin 时,我发现我的所有本地分支都配置了git pull并推送到远程分支。
但我更喜欢它,当我输入没有 origin branchname git pull 时,git只会推送实际分支>。
有没有配置开关,我可以改变这种行为?
git config push.default上游
#或
git config push.default简单
#或
git config push.default当前
这三者仅用于推送当前分支。
正如我在 git - push current 与
: push upstream
(跟踪)
只推动一个分支(模式为
简单
,当前
或upstream
)可以避免这种情况即使某些分支尚未准备好推送,所有匹配的分支都会被推送(默认匹配
)。
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?
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.
这篇关于防止该git推到所有分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!