0

是否可以使用另一个 GIT 存储库的一部分创建一个全新的 GIT 存储库?

让我解释。我有一个包含几个模块的中等大小的存储库。这个“系统”可以完全或模块化使用。但是从主存储库中取出每个模块所需的所有文件并不总是一件容易的事。

所以我想知道我是否可以创建一些小型存储库,假设每个模块都有一个具有所有依赖项的模块,并使它们与主存储库保持同步。

从概念上讲,这将是一个子模块,但除非我错了,否则这不是此功能的用途。

4

1 回答 1

0

Git submodules let you to move entire subdirectory into separate repository and link to exact commit in there.

If your modules overlap, like you have few shared directories and each module has few files in each of these dirs, then you need to redesign your modules. Git submodules are nice when you have dir hiearchy like this:

 |-- application
 |   |-- class
 |   `-- some stuff
 |
 `-- plugins
     |-- first
     |   |-- class
     |   `-- some stuff
     |-- second
     |   |-- class
     |   `-- some stuff
     `-- third
         |-- class
         `-- some stuff

Where plugins/first, plugins/second, and plugins/third are submodule root directories.

于 2013-02-25T20:42:51.967 回答