简体   繁体   English

从多个存储库中获取最新提交,然后合并到另一个存储库中,而无需创建新的存储库

[英]Take latest commits from multiple repos then merge into another single repo without creating a new repo

As per the requirement we have got mutliple repo containing many projects and have merged these into single repo which contains all the projects which exists in multiple repo. 根据要求,我们得到了包含多个项目的多重仓库,并将它们合并为一个包含多个仓库中所有项目的单个仓库。 I have done merged these into single repo and it contains all the commits till the merged date. 我已经将这些合并到单个回购中,并且包含了直到合并日期为止的所有提交。 After the merge ,Single repo doesn't contain those new commits present in multiple repo. 合并后,单个存储库不包含多个存储库中存在的那些新提交。

My question is 我的问题是

1)How can we pick the latest commits from multiple repo 1)我们如何从多个仓库中选择最新提交

2)If it is possible to pick those commits how it could be merged to single repo 2)如果可以选择那些提交,如何将其合并到单个仓库中

Have tried with cherry-picking but it creates the new commit id which differs from that of multiple repo commit id that should not happen in our case. 尝试了樱桃采摘,但是它创建的新提交ID与本例中不应发生的多个回购提交ID不同。

I would advice you to use submodules . 我建议您使用子模块 But your "final" repo will be updated with the new commits on sub repos so I don't know if it's what you want to do. 但是您的“最终”存储区将使用子存储区上的新提交进行更新,因此我不知道这是否是您要执行的操作。

I may have another solution : 我可能有另一种解决方案:

  • make a new git repo git init 制作一个新的git repo git init
  • add remotes for each repo you want to add git remote add origin1 http://myurl.com 为每个要git remote add origin1 http://myurl.com添加遥控器git remote add origin1 http://myurl.com
  • add all files for all remotes : git checkout origin1/master -- . 添加所有远程的所有文件: git checkout origin1/master -- .

I'm not sure if it will work but I will definitely try out 我不确定是否可以使用,但我一定会尝试

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

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