Git 创建父子仓库

发布时间 2023-12-14 11:13:43作者: Micky233

git submodule 父子仓库新建命令把父仓库clone下来git clone xxxxxx.git //仓库地址进入父仓库里面, 添加
//git submodule add <仓库地址> <本地路径>
git submodule add xxxxxx/mc-app.git mc-app在这个过程中,子仓库的代码会自动clone下来把每个子仓库都拉取到父仓库下就可以提交了git add . git commit -m "增加子仓库"

提交到远程仓库 使用 -u 下次提交就可以直接使用git push git push -u origin "master"git 命令 -u 含义官网解释(大概意思就是使用-u时的本地分支与远程分支建立联系,下次使用要指定分支的命令时可以不用再指定分支) -u --set-upstream For every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull and other commands.克隆父仓库时可使用此命令 递归克隆所有仓库$ git clone --recurse-submodules https://github.com/chaconinc/MainProjectGit

官方文档 https://git-scm.com/book/zh/v2/Git-工具-子模块