如何使用Git跟踪给定分支的多个远程? [英] How to track more than one remote with a given branch using Git?

查看:120
本文介绍了如何使用Git跟踪给定分支的多个远程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况是这样的:

我有多个远程存储库 - 供参考,可以说一个是alpha存储库,并且我们最近设置了建立一个新的测试版存储库,一些用户已经迁移到该存储库。



这两个存储库都有一个master分支。



如何设置我的本地主文件,以便它会尝试自动将两个推送到 beta版本库,而无需手动指定远程我想每次使用?



我应该详细说明,我不想设置两个本地分支'master-alpha'和'master-beta',我想要同一个本地分支来跟踪这两个遥控器。

解决方案

我不认为它是可能有一个git命令。

另一种方法是定义一个git别名,它可以从一个回购库中将git拉出来,然后将git从另一个回收站中拉出来。



但是如果两位大师之间的提交历史差异很大,这很快就会导致大量的冲突......


The situation is this:

I have more than one remote repository - for reference, lets say that one is the "alpha" repository, and we have recently set up a new "beta" repository, which some users have migrated to.

Both repositories have a "master" branch.

How do I set up my local master such that it will attempt to automatically push and pull to and from both the alpha and beta repositories, without manually specifying the remote I want to use each time?

I should elaborate that I don't want to set up two local branches 'master-alpha' and 'master-beta', I want the same local branch to track both remotes.

解决方案

I don't think it is possible with one git command.
The other alternative would be to define a git alias which would git pull master from one repo, and then git pull master from the other.

But if the history of commits differ too greatly between the two master, that would quickly lead to a massive number of conflicts...

这篇关于如何使用Git跟踪给定分支的多个远程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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