所以,我会用这样的一系列命令去,在MainRepo
在本地:
> git checkout -b merge-others
> git remote add ARepo https://a_repo.git # Replace with proper URL
> git remote add BRepo https://b_repo.git # Replace with proper URL
到目前为止,你所做的一切是由MainRepo知道别人的。现在这样做:
> git fetch ARepo
> git fetch BRepo
它从两个遥控器中检索分支/提交信息。然后,在适当的分支合并其他两个:
> git merge ARepo/master # Resolve any merge conflicts
> git merge BRepo/master # Resolve any merge conflicts
最后,你要推到你的私人和公共回购:
> git remote add privateRepo https://private_repo.git # Replace with proper URL
> git push -u privateRepo HEAD
> git remote add publicRepo https://public_repo.git # Replace with proper URL
> git push -u publicRepo HEAD
至于制作的MainRepo
拉入请求,这取决于在你的平台上。如果你使用GitHub,这很简单,但我不能说其他平台。祝你好运!
'ARepo','BRepo'和'MainRepo'是否有共同的历史或结构?否则,您可能会发现合并它们是一项艰巨的任务。 –
他们没有。一开始,我想到了将它们分开放入新项目中的模块。他们都使用maven结构。然后启动边际代码。 Main和B repo是github回购,私人回购将在bitbucket上托管。 –