简体   繁体   English

将带有子模块的git repo作为目录复制到另一个repo

[英]Copy git repo with sub-modules as directory into another repo

Recently I cloned gRPC repo from GitHub which has various submodules like protobuf, zlib, etc. I have a different repo X of my own. 最近,我从GitHub克隆了gRPC库,该库具有各种子模块,例如protobuf, zlib,等。我有一个自己的存储库X Following is what I did. 以下是我所做的。

  1. copied gRPC folder into folder X gRPC文件夹复制到文件夹X
  2. pushed the changes of X into origin master X的更改推送到原始主机
  3. cloned origin master into another repo Y 将原始主数据库克隆到另一个仓库Y
  4. Now, I don't see contents of protbuf, zlib, etc. in Y 现在,我在Y protbuf, zlib,不到protbuf, zlib,等的内容

Seems I did something wrong in steps 2 and 3. All I wanted to do was put everything from gRPC into X as clean directory structure. 好像我做错了什么事在步骤2和3。所有我想要做的是把一切从gRPCX为干净的目录结构。 What are the steps to accomplish this? 有哪些步骤可以做到这一点?

I removed all .git and .gitmodules from all directories that I wanted to be part of X . 我从我希望成为X一部分的所有目录中删除了所有.git.gitmodules Then, for each of those folders did the following as explained in https://stackoverflow.com/a/31270959/4825809 然后,针对每个文件夹执行以下操作,如https://stackoverflow.com/a/31270959/4825809所述

git rm --cached directory
git add directory

Now I can see committed protobuf in fresh clone . 现在,我可以看到新鲜clone protobuf

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

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