所以,我會用這樣的一系列命令去,在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上託管。 –