Git repository inside another git repository

后端 未结 2 1187
小蘑菇
小蘑菇 2020-12-25 11:33

I have the following directories structure:

  • g1/
    • .git
    • a
    • b
    • c/
2条回答
  •  半阙折子戏
    2020-12-25 11:38

    Submodules (discussed in the Pro Git Book), helps manage repositories nested within a main repository:

    Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.

    They are not to be confused with remotes, which are meant mainly for branches of the same project; submodules are meant for different projects you would like to make part of your source tree, while the history of the two projects still stays completely independent and you cannot modify the contents of the submodule from within the main project.

    Submodules maintain their own identity; the submodule support just stores the submodule repository location and commit ID, so other developers who clone the superproject can easily clone all the submodules at the same revision.

提交回复
热议问题