Git 子模块

添加子模块

git submodule add https://github.com/example/example-submodule.git path/to/submodule

克隆带有子模块的仓库

git clone --recurse-submodules https://github.com/example/example-repo.git

# 如果你已经克隆了父仓库,你可以运行以下命令来初始化和更新子模块
git submodule update --init --recursive

更新子模块

cd path/to/submodule
git pull

# 或者你也可以在父仓库的目录中使用 `git submodule update` 来更新所有子模块
git submodule update --remote

删除子模块

rm -rf path/to/submodule
git rm --cached path/to/submodule
git commit -m "Removed submodule"
git push