上游与给定存储库不同时的Git行为 [英] Git behavior when upstream is different than given repository

查看:57
本文介绍了上游与给定存储库不同时的Git行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道下面描述的行为是否是bug或作为desugm工作,无论如何我无法在git文档中找到对此的支持.

I wonder if the below described behavuour is bug or works as desugm anyhow i cant find support for it in git documents.

让我们假设

# git version is 2.13.3
#Local repository has two remotes origin and dev
git push -u origin br6:br6ups # "Branch br6 set up to track remote branch br6ups from origin."
#assume push.defualt is upstream
#what is the expected behavior ?
git push dev br6

好吧,上游是origin/br6ups,但是git将其推送到dev/br6ups

Well, the upstream is origin/br6ups, but git pushs to dev/br6ups

GIT似乎忽略了"branch.br6.remote",而仅使用了"branch.br6.merge"

it seems that GIT ignores 'branch.br6.remote' and uses only 'branch.br6.merge'

  1. 这是有效的行为吗?
  2. GIT不能保护我推送到其他存储库吗?
  3. 任何人都可以将我定向到描述此行为的某个文档吗?

谢谢 波阿斯

推荐答案

否,git不应保护您"不要推送到其他存储库.配置设置是默认设置.您是通过命令行选项指定了要推送到其他远程服务器的(因此git只是使用config来找出推送到该远程服务器的默认refspec规则).

No, git should not "protect you" from pushing to a different repository. The config settings are defaults; you specified via command line options that you wanted to push to a different remote (so then git just used config to figure out the default refspec rules for pushing to that remote).

推送行为的范围(例如,按什么顺序使用哪些配置设置,哪些命令行参数覆盖哪些配置设置等):

The range of push behaviors (e.g. which config settings are used in what order, which command line arguments override which config settings, etc.) is described here: https://git-scm.com/docs/git-push

这篇关于上游与给定存储库不同时的Git行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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