但是如果这时候的commit id跟主项目里记录的 submodule 的 commit id 不一致,你会在主项目仓库看到diff,你可能需要提交主项目更新。 方法二,主项目执行git submodule update --remote [submodule文件夹相对路径] 这个方法会自动拉取submodule的主分支(通常叫master或main)的最新版本。效果跟方法一一致。 如果你不带参...
要指定子模块到特定的commit,你需要进入子模块的目录,并切换到你想要的commit。例如,假设你的子模块位于path/to/submodule,并且你想要切换到commit abc12345: bash cd path/to/submodule git checkout abc12345 3. 更新主项目中的子模块引用 切换子模块的commit后,你还需要在主项目中更新对子模块commit的引用。这...
git submodule add<repository><path>//添加子模块 执行命令 代码语言:javascript 代码运行次数:0 运行 AI代码解释 git submodule add https://github.com/yang0range/SubModuleDemoLib.git SubModuleDemoLib 4.查看状态 接下来,我们执行命令 代码语言:javascript 代码运行次数:0 运行 AI代码解释 cat.gitmodules 可以...
git submodule add https://git.oschina.net/gaofeifps/leg.git 这时查看下状态会多两个文件 ➜ body git:(master) ✗ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) ...
随后,运行git add . (注意点)以更新引用仓库的编号信息 最后,运行git commit和git push以更新云端的子模块版本号 命令如下 git pull git submodule update --init --recursive git submodule update --remote --merge git diff git add . git commit -m "update submodule"...
git commit提交即完成子模块的添加 子模块的使用 克隆项目后,默认子模块目录下无任何内容。需要在项目根目录执行如下命令完成子模块的下载: git submodule init git submodule update 1 2 或: git submodule update --init --recursive 1 执行后,子模块目录下就有了源码,再执行相应的makefile即可。
Learn all about Git submodules, their purpose/ uses, how to add & remove a submodule, and how to pull/ commit changes with the help of syntax & examples.
第一步:使用submodule add...添加子模组 第二步:查看.gitmodules的内容 2. 克隆带子模组的版本库的步骤 第一步:克隆super主版本库 第二步:克隆子模组 3. 对主Git库工作区作commit、checkout、revert、pull、push等更改Git工作区内容的操作时,查看Submodule目录下内容的效果 ...
$ git commit -m "add submodule" 提交后,在主项目仓库中,会显示出子模块文件夹,并附带其所在仓库的版本号,如:foo @ abcd1234。 2.2 获取 submodule 使用git submodule add命令会自动拉取子工程项目代码到指定目录,但其他开发者获取主项目代码时,使用git clone命令是不会拉取到子项目的代码的,必须运行两条命...
cd<path_to_submodule> git pull origin main 然后回到主项目目录,提交子模块的更新: cd.. git add <path_to_submodule> git commit -m"Update submodule" 4. 删除 Submodule 要从项目中删除一个子模块,步骤如下: 删除子模块的条目: git submodule deinit -f -- <path_to_submodule> 删除子模块的目录: ...