git如何添加子模块

①克隆父仓库

$ git clone https://github.com/a/a.git  本地路径

②添加子仓库

$ git submodule add https://github.com/a/b.git

③push到父仓库

$ git add .

$ git commit -m ‘添加子模块’

$ git push

注: 当第二步(添加子仓库)操作完成之后,项目中将生成gitmodules文件

文件内容如下:

[submodule "b"]
       path = b

       url = https://github.com/a/b.git

posted on 2022-12-30 08:59  奔跑吧,蜗牛!  阅读(444)  评论(0编辑  收藏  举报

导航