【问题标题】:how to push different branches to different remote repos in one repo?如何在一个仓库中将不同的分支推送到不同的远程仓库?
【发布时间】:2022-01-14 07:50:21
【问题描述】:

我有一个本地仓库,它有一些分支,例如branch1, branch2..

我想将分支推送到不同的远程仓库,如何?

【问题讨论】:

  • 这是关于配置你的 git 遥控器。我会建议了解他们。从长远来看,它将对您有所帮助。 Stackoverflow 已经有很多帖子可以帮助你。 This can help。还有For more detailed explanation

标签: git github gitlab


【解决方案1】:

简单

git push https://repo.one/there branch1
git push https://repo.two/elsewhere branch2

如果你想缩短你的命令,你可以预定义远程目的地:

git remote add one https://repo.one/there
git remote add two https://repo.two/elsewhere

那么命令可以缩短为

git push one branch1
git push two branch2

您还可以设置默认推送目的地:

git branch --set-upstream-to=one/branch1 branch1
git branch --set-upstream-to=two/branch2 branch2

【讨论】:

    猜你喜欢
    • 2011-07-08
    • 2023-01-13
    • 1970-01-01
    • 2019-03-17
    • 1970-01-01
    • 2021-04-07
    • 2016-06-26
    • 1970-01-01
    • 2013-01-04
    相关资源
    最近更新 更多