git submodule subtree常用指令

submodule

官方文档

添加

git submodule add -b master git@git.xxx:xxx/xxx.git src/xxx

删除

git submodule deinit -f src/xxx     // 取消注册
git rm -rf src/xxx                  // git 工作树和索引中删除文件
rm -rf .git/modules/src/xxx

subtree

带着提交记录来拷贝仓库的话就用subtree

git subtree add --prefix=src/xxx git@git.xxx:xxx/xxx.git master

原文地址:https://www.cnblogs.com/amiezhang/p/11354599.html