如何从git中的另外4个回购自动下载相同的8个回购?

如何从git中的另外4个回购自动下载相同的8个回购?,git,repository,git-submodules,git-subtree,Git,Repository,Git Submodules,Git Subtree,我们有4个带有可执行文件的repo,当我克隆其中任何一个时,我还想将所有带有库的8个repo克隆到可执行文件文件夹旁边的文件夹中。可执行文件类似于服务,它们全部4个都将使用库的主要存储库中的最新版本。我还想在克隆任何一个库repo时克隆所有8个库repo So I can for example clone executable1 and have folders: executable1-library1-..-library8 or clone library1 and have fol

我们有4个带有可执行文件的repo,当我克隆其中任何一个时,我还想将所有带有库的8个repo克隆到可执行文件文件夹旁边的文件夹中。可执行文件类似于服务,它们全部4个都将使用库的主要存储库中的最新版本。我还想在克隆任何一个库repo时克隆所有8个库repo

So I can for example clone executable1 and have folders: executable1-library1-..-library8 or clone library1 and have folders: library1-..-library8 or end up cloning all of the executables and have folders: executable1-..-executable4-library1-..-library8. 所以我可以举个例子 克隆可执行文件1并具有文件夹: 可执行1-库1-…-库8 或克隆library1并拥有文件夹: 图书馆1-…-图书馆8 或者最终克隆所有可执行文件并创建文件夹: 可执行1-…-可执行4-库1-…-库8。 所以我不想每次都下载所有的可执行文件,但我想每次都下载所有的库

我一直在考虑子模块,但是它们的文档很糟糕,也许整个功能很差,我不知道。然后我一直在思考git中的子树和其他结构。还有一种可能性是,我总是手动分别克隆所有8个库,这将是悲哀的

So what is the best way to 1) automatically download all of the 8 libraries to their folders (next to the folder of the executable if it was caused by cloning executable)? 2) automatically download all of the 8 libraries to their folders next to the folder of the executable during the cloning of the executable? 那么,最好的解决方法是什么呢 1) 自动将所有8个库下载到它们的文件夹中(如果是克隆可执行文件导致的,则位于可执行文件文件夹旁边)? 2) 在克隆可执行文件期间,是否自动将所有8个库下载到可执行文件文件夹旁边的文件夹中? 第一个选项更基本-分两步完成(1.可执行文件+2.库),第二个对我来说更好,只需分一步完成(可执行文件和库一起)

我的部分问题在这里得到了解决:

我还想对库进行更改,即使它们是与可执行文件一起下载的,并将这些更改推送到它们的存储库中


编辑:我添加了最后一句话,并补充说1个库也应该下载其他库

您仍然可以使用子模块,和

然后,一个简单的示例就足以恢复所有子模块内容。

git子模块更新--remote
将确保它们反映其最新的主分支状态。

子模块是常规git存储库:您可以创建分支,并添加提交和推送。我的答案是正确的。答案是好的,我不知怎么地期待着,但我认为会有更多的想法和它们之间的比较等等,但可能没有人感兴趣。我必须首先考虑这一点,然后在沙箱回购(sandboxrepo)上进行尝试。
git submodule add -b master -- /url/library1