简体   繁体   English

合并2个不同的git Repos

[英]Merge 2 Different git Repos

I have two different local git repos. 我有两个不同的本地git回购。 Each is hosted on github as (separate) private repos, with its own set of collaborators / developers. 每个都作为(单独的)私人回购托管在github上托管,拥有自己的一组协作者/开发者。 I am the owner of those two github repos. 我是那两个github回购的所有者。

# Repo A, which  is in
~/projects/repo-a
# Repo B, which is in
~/projects/repo-b

I have two questions: * How do I merge repo-a to repo-b , and vice versa. 我有两个问题:*如何将repo-a合并到repo-b ,反之亦然。 Is it possible? 可能吗? * If it's possible, can we make repo-a collaborators do not show up on repo-b , and vice versa? *如果有可能,我们可以制作回购 -合作者不会出现在repo-b上 ,反之亦然吗? The idea is to keep the confidentiality of the repo collaborators. 这个想法是为了保持回购合作者的机密性。

Thanks. 谢谢。

Submodules are not the best for frequent commits. 子模块不是频繁提交的最佳选择。 In my project I use git-slave , which is a little out of date, but suits all my needs :) 在我的项目中,我使用git-slave ,这有点过时,但适合我的所有需求:)

Check out " How do you merge two git repositories? ". 看看“ 你如何合并两个git存储库? ”。 In short: Learn about "submodules" and "subtree merging". 简而言之:了解“子模块”和“子树合并”。

My suggestion: read the git book: 我的建议:阅读git书:

$ git remote add repo-a <url a>
$ git remote add repo-b <url b>
$ git fetch repo-a
$ git fetch repo-b
$ git checkout repo-a/master
$ git checkout -b merging-branch
$ git merge repo-b/master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM