Git 子模块
git submodule -h
git submodule [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>] git diff --cached :: 确定修改 git commit :: ---(写描述)commit .gitmodules git push :: push commit to remote
- -b <branch> specify sync which submodule branch
- --name <name> submdoule name ,default is path
注意:子模块仓库填的URL是SSH还是HTTPS,推荐使用SSH方式连接GIT,避免密码修改需要重新填写HTTPS
例:添加子模块到仓库,配置拉取时拉分支为Alpha的子模块。子目录本地路径:<repoRoot>/script/pipe
git submodule add -b Alpha git@gitlab.XXXXXX.com:data/test_git_runner.git script/pipe
::递归拉取所有子模块及其子模块的子模块 git clone <repo> --recurse-submodules ::只拉取当前仓库的子模块 git submodule init git submodule update ::递归拉取所有子模块及其子模块的子模块 git submodule update --init --recursive
rmdir /s /q <submodulDir> rmdir /s /q <RepoDir/.git/modules>
git config -f .gitmodules submodule.<subModuleName>.branch <branch> git submodule update --remote git status :: .gitmodules 被修改了 git add .gitmodules git commit git push