在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...
方法一,先 clone 父项目,再初始化 submodule,最后更新 submodule。 初始化只需要做一次,之后每次只需要直接 update 即可,需要注意 submodule 默认是不在任何分支上的,它指向父项目存储的 submodule commit id。 git clone project.git project2 cd project2 git submodule init git submodule update 方法二,采用递归...
这是默认配置,通过在refs/remotes/origin下创建对远程分支头的引用,并初始化remote.origin.url和remote.origin.fetch配置变量来实现。 语法 git clone [--template=<template-directory>] [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror] [-o <name>] [-b <name>] [-u <upload-...
See git-clone[1]. clone.filterSubmodules If a partial clone filter is provided (see --filter in git-rev-list[1]) and --recurse-submodules is used, also apply the filter to submodules. color.advice A boolean to enable/disable color in hints (e.g. when a push failed, see advice...
git fetch ;; *) shift git fetch $(get_default_remote) "$@" ;; esac ) # # Update each submodule path to correct revision, using clone and checkout as needed # # $@ = requested paths (default to all) # cmd_update() { # parse $args after "submodule ... upd...
6. 克隆子模块:如果远程仓库中包含子模块,可以使用–recurse-submodules参数同时克隆子模块。例如,git clone –recurse-submodules <远程仓库URL>。 7. 克隆速度优化:git clone命令支持一些选项来优化克隆速度。例如,–depth参数可以将克隆的深度限制为指定的版本数,–single-branch参数可以限制克隆只包含指定的分支,–...
默认情况下,`git clone`命令会将整个代码历史克隆到本地。如果你只需要克隆最新的几个提交,可以使用`–depth`选项指定克隆深度。 4. 克隆子模块:`git clone –recurse-submodules <远程仓库地址>` 如果代码仓库使用了Git的子模块功能,你可以使用`–recurse-submodules`选项来克隆这些子模块。
这就给你留下了一个别名(或git别名)解决方案,用一个命令替换git clone --recursive(类似于“...
Git对于Submodule有特殊的处理方式,在一个主项目中引入了Submodule其实Git做了3件事情: 记录引用的仓库 记录主项目中Submodules的目录位置 记录引用Submodule的commit id 在project1中push之后其实就是更新了引用的commit id,然后project1-b在clone的时候获取到了submodule的commit id,然后当执行git submodule update的时候...
Create ashallowclone with a history truncated to the specified number of commits. Implies--single-branchunless--no-single-branchis given to fetch the histories near the tips of all branches. If you want to clone submodules shallowly, also pass--shallow-submodules. ...