代码之家  ›  专栏  ›  技术社区  ›  cucuru

如何查看具有多个原点的远程分支

git
  •  2
  • cucuru  · 技术社区  · 6 年前

    我的git存储库中有两个来源:

    user@user:$ git remote -v
          origin1   https://github.com/Company_Name/repository_name1.git (fetch)
          origin1   https://github.com/Company_Name/repository_name1.git (push)
          origin2   https://github.com/Company_Name/repository_name2.git (fetch)
          origin2   https://github.com/Company_Name/repository_name2.git (push)
    

    我可以推拉都没有任何问题。

    现在我想看看origin2的远程分支,我可以得到它。我的尝试:

    user@user:$ git branch -a 
    

    但所有的分支都来自原始

    1 回复  |  直到 6 年前
        1
  •  2
  •   Mehdi    6 年前

    你应该先去拿 origin2 遥控器。

    一旦抓取完成,则 git branch -a

    git fetch origin2
    git branch -a
    

    另外,您可能需要为遥控器指定一个比 原文2 upstream , mirror , backup ? 一切都有意义。