How to `git submodule add` Existing sub Repository?

后端 未结 5 1905
既然无缘
既然无缘 2021-01-18 02:56

The Question

How to add existing sub repository as a submodule in git?

The Why

I have a private codespace supermodule with submodule

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-18 03:27

    One way to do it is to manually create the .gitmodules file.

    The format is below:

    [submodule "path/to/submodule1"]
        path = path/to/submodule/1
        url = git@github.com:user/submodule1
    [submodule "path/to/submodule2"]
        path = path/to/submodule/2
        url = git@github.com:user/submodule2
    

    Note you'll have to run

    git submodule sync
    

    to apply the changes

提交回复
热议问题