作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我想阻止 git push 和 pull 到所有远程分支。我知道开关 --all 并且我希望当我设置这个开关时 git 只会推送到 all 。
当我输入 git remote show origin 时,我看到我所有的本地分支都配置为 git pull 并推送到远程分支。
但我更喜欢这样,当我输入没有origin branchname 的git pull 时,git 只会推送实际的分支。
有没有我可以更改此行为的配置开关?
最佳答案
考虑新的default push policy ,你可以尝试设置:
git config push.default upstream
# or
git config push.default simple
# or
git config push.default current
这三个都只用于推送当前分支。
正如我在“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 - 防止 git 推送到所有分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15597959/
我是一名优秀的程序员,十分优秀!