有submodule
的repo的拉取
方法一,递归的方式克隆整个项目
git clone <repository> --recursive
方法二,正常clone
,然后init
+update
git clone <repository>
git submodule init #根目录执行
git submodule update #根目录执行
子模块更新1:
git submodule foreach #git pull 拉取所有子模块
子模块更新2:1
#更新 repo/.gitmodules
#更新 repo/.git/config
git submodule sync
在repo中加入submodule
git submodule add <repository> <path>
注: submodule
的 path 不能以/
结束
在repo中删除submoudle
git rm –cached <repo_path> #去掉git对文件的跟踪,如过不想保留文件,可以直接git rm
然后在 文件 repo/.gitmodules
和文件repo/.git/config
中删除 submodule 相关的内容