Reputation: 34645
I want merge 3 git repos with history and then I want be able to push different branch in 2 repos and make merge request to MainRepo. I have MainRepo, ARepo and BRepo. I want merge ARepo and BRepo to MainRepo as a result I should get new_branch. This new branch should be pushed to my privateRepo. Also I want be able push some branches (which will be created later as a stable version) to publicRepo. Last but not least I want be able make merge request to MainRepo. It is possible and wow I should configure git project to achive this?
Upvotes: 0
Views: 42
Reputation: 4864
So, I'd go with something like this series of commands, in MainRepo
on your local:
> 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
So far, all you've done is made MainRepo aware of the others. Now do:
> git fetch ARepo
> git fetch BRepo
Which retrieves the branch/commit info from the two remotes. Then, merge in the appropriate branches from the other two:
> git merge ARepo/master # Resolve any merge conflicts
> git merge BRepo/master # Resolve any merge conflicts
Finally, you want to push to your private and public repos:
> 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
As for making a pull request for MainRepo
, that depends on your platform. If you're using GitHub it's simple, but I can't speak for other platforms. Good luck!
Upvotes: 1