git 子仓库的操作

添加子仓库

git submodule add http://git-server.com/namespace/A_module A_module
git submodule add http://git-server.com/namespace/B_module B_module
git submodule add http://git-server.com/namespace/C_module C_module

提交更改

git add .gitmodules A_module B_module C_module
git commit -m "chore: add submodules"

如果目录里以前加过失败残留,需要先清理再重新加:

rm -rf A_module B_module C_module
rm -rf .git/modules/A_module .git/modules/B_module .git/modules/C_module

全新所有子仓库克隆仓库到本地

git clone --recurse-submodules http://git-server.com/namespace/project [dist-dir]