在project1中push之后其实就是更新了引用的commit id,然后project1-b在clone的时候获取到了submodule的commit id,然后当执行git submodule update的时候git就根据gitlink获取submodule的commit id,最后获取submodule的文件,所以clone之后不在任何分支上;但是master分支的commit id和HEAD保持一致。 查看~/submd/ws/project1...
然后发现submodule还有submodule,他们是https,于是失败了 git submodule update --init --recursive --force # step 0x02: 批量修改当前repo的.gitmodules以及二级、三级等的.gitmodules sed -i "" "s/https:\/\/
$ git clone --recursive /path/to/repos/foo.git git help 解释: --recursive, --recurse-submodules After the clone is created, initialize all submodules within, using their default settings. This is equivalent to running git submodule update --init --recursive immediately after the clone is fi...
Git对于Submodule有特殊的处理方式,在一个主项目中引入了Submodule其实Git做了3件事情: 记录引用的仓库 记录主项目中Submodules的目录位置 记录引用Submodule的commit id 在project1中push之后其实就是更新了引用的commit id,然后project1-b在clone的时候获取到了submodule的commit id,然后当执行git submodule update的时候...
git submodules拉取其他分支 结论 拉取git远程仓库中特定的单个分支的关键在于:“调用git clone时候,添加--branch选项与 --single-branch”。 git clone git clone克隆远程仓库时,默认会依次做以下事情: 创建本地的“远程追踪分支”,用于记录远程仓库中每个分支在克隆仓库时的状态。
clone.defaultRemoteName 克隆仓库时要创建的远程名称。默认为origin,并且可以通过传递--origin命令行选项给git-clone[1]进行覆盖。 clone.rejectShallow 拒绝克隆浅仓库;可以通过在命令行上使用--reject-shallow选项来覆盖此设置。参见git-clone[1]。 clone.filterSubmodules 如果提供了部分克隆过滤器(参见git-rev-list...
2.1 创建Git Submodule测试项目 2.1.1 准备环境 1 2 3 henryyan@hy-hp ~pwd /home/henryyan mkdir-p submd/repos 创建需要的本地仓库: 1 2 3 4 5 cd~/submd/repos git--git-dir=lib1.gitinit--bare git--git-dir=lib2.gitinit--bare ...
git submodule update --init --recursive1 如果你不确定子模块是否都已经下载完全了,也可以执行一遍这个命令确认一下。 3. 参考 git clone --help git 2.7.4版本: --recursive, --recurse-submodules After the clone is created, initialize all submodules within, using their default settings. This is eq...
The rule to determine which remote branch to merge after fetching is a bit involved, in order not to break backward compatibility. If explicit refspecs were given on the command line of git pull, they are all merged. When no refspec was given on the command line, then git pull uses the...
2.1 创建Git Submodule测试项目 2.1.1 准备环境 ➜ henryyan@hy-hp ~ pwd /home/henryyan mkdir -p submd/repos 创建需要的本地仓库: cd ~/submd/repos git --git-dir=lib1.git init --bare git --git-dir=lib2.git init --bare git --git-dir=project1.git init --bare ...