git submodule也就是git子模块,当项目依赖其它仓库的时候,就用得上submodule了,子模块更新,本地仓库也可以跟上更新,并且不用在remote保存子模块代码
1. 连同子模块一起clone clone main repository and submodule
1
|
git clone https://github.com/username/project-main.git --recurse-submodules
|
or after clone
1
|
git submodule update --init --recursive
|
2. 添加 add submodue
1
|
git submodule add http://github.com/xxx/yyy.git plugins/yyy
|
3. 初始化 init submodule
1
|
git submodule update --init --recursive
|
4. 更新 update submodule
1
|
git submodule update --remote --merge
|
5. 删除 delete submodule
新版本
1
|
git submodule deinit <submodule-name>
|
老版本
- rm -rf the folder
- remove submodules from
.gitmodules
- remove submodules from
.git/config
- rm -rf
.git/module/yourmodule