8
我有一个Git项目。我们将其命名为Proj
。重用Git子模块的子模块
Proj
有两个子模块,Lib
和Utils
。
Lib
也有子模块Utils
。
现在的问题是,当有人想要git clone --recursive Proj
时,他需要两次下载Utils
。当项目进一步深入时,情况可能会更糟。
那么我怎样才能让Proj
重用Utils
已经下载Lib
?
我的工作树:
Proj # Main project
+-- .git
`-- external
+-- Lib # Proj depends on Lib
| +-- .git
| `-- external
| `-- Utils # Lib depends on Utils
| `-- .git
`-- Utils # Proj also depends on Utils
`-- .git
注:
较好的是,
Utils
停留在external/Utils
。由于Windows的兼容性,不允许使用符号链接。
我会很感激,如果任何人都可以帮助我这样一个复杂的问题。
也许最好是使用某种依赖管理工具。我们不知道您使用的是哪种技术,但是像Maven或npm这样的工具是为了这样的事情而制作的。我没有看到使用Git子模块的巨大好处 - 它们只能阻碍。 – nwinkler 2015-02-23 14:01:24
我正在使用CMake进行C++项目。 'Utils'是一些常见的头文件。迁移到Maven会非常痛苦吗? @nwinkler – 2015-02-23 14:08:55
Maven主要面向Java项目,它不会帮助您使用C++项目。以下是一些类似讨论的链接:http://stackoverflow.com/questions/1827705/c-buildsystem-with-ability-to-compile-dependencies-beforehand和http://www.reddit.com/r/cpp/评论/ 2eiulw/dependency_manager_for_ccmake_projects/ – nwinkler 2015-02-23 14:34:46