git submodule 用法

在这里插入图片描述

子仓库启蒙

在根目录执行:

git submodule add [email protected]:liaosp/dcat-admin-basic-interface.git

想要子模块指定的分支:

git submodule add -b dev <仓库地址> <子模块路径>

这样相当于在根目录上添加了 .gitmodules 信息,相当于composer 中的文件

在新的服务器上部署的时候就不是使用 git clone 了,因为这样会发现submodule 子项目会出不来

git clone --recurse-submodules <主仓库地址>

如果已经使用了这个命令了,还有挽救的机会,执行:

子项目初始化

git submodule update --init --recursive

主仓库和子仓库同时更新

git submodule update --remote --merge

指定子仓库更新

git submodule update --remote <子仓库名称>

猜你喜欢

转载自blog.csdn.net/qq_22823581/article/details/134827688