git submodule update --init --recursive`是一个用于初始化并更新 Git 子模块的命令,其中包含了三个参数: 1. update: 这个参数告诉 Git 更新子模块。如果不指定此参数,Git 将不会更新子模块,而只是确保它们处于正确的提交状态。 2. --init: 这个参数告诉 Git 初始化尚未初始化的子模块。如果你的仓库包含子...
git submodule是git系统中非常实用的一个功能,对于可复用模块非常有用。 通常情况下,只使用git clone是无法下载到子模块的信息,可以尝试使用git clone --recursive 或者执行git clone后再执行git submodule update --init 还可以执行git clone后再执行git submodule init和git submodule update 那么git submodule init和...
有些时候你需要对submodule做一些修改,很常见的做法就是切到submodule的目录,然后做修改,然后commit和push。 这里的坑在于,默认git submodule update并不会将submodule切到任何branch,所以,默认下submodule的HEAD是处于游离状态的(‘detached HEAD’ state)。所以在修改前,记得一定要用git checkout master将当前的submodule...
git-submodule - Initialize, update or inspect submodules SYNOPSIS git submodule[--quiet] [--cached]git submodule[--quiet] add [<options>] [--] <repository> [<path>]git submodule[--quiet] status [--cached] [--recursive] [--] [<path>…]git submodule[--quiet] init [--] [<path...
git submodule update --init --recursive 新建分支 切到当前分支 git checkout 当前分支 从当前分支创建新的分支 git checkout -b 新的分支 上传到远程仓库 git push origin 新的分支 为当前工程添加submodule,命令如下: git submodule add 仓库地址 路径 ...
git submodule add “`其中,``为要添加的Submodule仓库的地址,``为Submodule在主仓库中的路径。 2. 克隆带有Submodule的仓库如果你要克隆一个带有Submodule的仓库,可以使用命令:“`git clone –recursive “`或者首先克隆主仓库,然后使用如下命令初始化Submodule并获取其代码:“`git submodule initgit submodule update...
七. 更改submodule的版本 我一开始直接用的git submodule update --remote path-to-submodule的指令,cmd界面上成功走完了,没报错,但是我进去我的submodule里,发现文件内容并没有改变,所以我想,应该是更新了对应的commits,但是我的submodule仓库的HEAD指针指向的版本没有修改。
这时候需要运行命令 git submodule init 去初始化本地配置文件以及 git submodule update 拉取代码。 $ git submodule init Submodule 'module/module1' (https://github.com/xxx/subrepo1.git) registered for path 'module/module1' Submodule 'subrepo' (https://github.com/xxx/subrepo.git) registered for ...
确保你正在执行git submodule update命令的目录是包含.git目录和.gitmodules文件的Git仓库的根目录。可以通过运行pwd(在Unix-like系统中)或cd(不带参数,然后查看当前路径)来检查当前工作目录。 确认.gitmodules文件存在: .gitmodules文件应该位于Git仓库的根目录下,并包含子模块的配置信息。你可以使用ls -a(在Unix-li...
$ git submodule update // 与主仓库中的子模块代码同步 $ git submodule update --remote // 与子仓库中代码同步(同步所有的子模块) $ git submodule update --remote xxx // 指定需要同步的子模块 子模块目录下更新: git pull 默认情况下会跟踪子模块的 master 分支,设置为...