在 git 中初始化一个 Select 子模块,而不是所有子模块

Initialize a Select Submodule in git rather then all of them

我有一个跨越许多项目的通用子模块,它被设计为在许多不同的平台上构建。由于我维护核心逻辑的代码和来自不同平台的接口,我有每个子模块来跟踪并针对所有平台构建代码,如下所示:

lib/core_logic_module/lib/
                         platform_1
                         platform_2
                         ...
                         platform_X

在处理需要特定平台的项目时,实际拥有特定于平台的模块非常好,这样可以在需要时检查更改,而不是不需要的更改。 Do a plane old git submodule update --init --recursive clones all the submodules and their specif dependencies which makes using grep, ctags, and find a pain 因为平台都有类似的硬件抽象文件.

在初始化子模块时有没有简单的方法指定我只想要一个模块?

您可以使用一条或多条路径 git submodule update
documentation 开始,您可以这样做:

git submodule update --init --recursive <path>...

一些关于 <path>... 的额外细节:

Paths to submodule(s). When specified this will restrict the command to only operate on the submodules found at the specified paths. (This argument is required with add).