Merge 2 Different git Repos

北城余情 提交于 2019-12-07 15:13:18

问题


I have two different local git repos. Each is hosted on github as (separate) private repos, with its own set of collaborators / developers. I am the owner of those two github repos.

# 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. Is it possible? * If it's possible, can we make repo-a collaborators do not show up on repo-b, and vice versa? The idea is to keep the confidentiality of the repo collaborators.

Thanks.


回答1:


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 :)




回答2:


Check out "How do you merge two git repositories?". In short: Learn about "submodules" and "subtree merging".

My suggestion: read the git book:

  • submodules
  • subtree merging



回答3:


$ 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


来源:https://stackoverflow.com/questions/11199602/merge-2-different-git-repos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!