防止该git推到所有分支 [英] Prevent that git pushes to all branches

查看:110
本文介绍了防止该git推到所有分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想阻止那个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆