方法二,主项目执行git submodule update --remote [submodule文件夹相对路径] 这个方法会自动拉取submodule的主分支(通常叫master或main)的最新版本。效果跟方法一一致。 如果你不带参数[submodule文件夹相对路径],就会更新所有 submodules。 注意事项,更新后需提交主项目变更。 当我们
递归克隆整个项目submodule:git clone https://github.com/demo.git assets --recursive 递归更新整个项目submodule:git submodule foreach git pull 删除子模块:git rm --cached subModulesA rm -rf subModulesA --recursive表示递归地克隆git_parent依赖的所有子版本库。 git subtree(子树合并) 上面介绍的git subm...
在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...
git submodule foreach 'git pull' 删除 submodule 按照当前的例子,从 project-main 中删除 project-sub-1,应该使用: git submodule deinit project-sub-1 git rm project-sub-1 若由于本地的子模块有未提交的改动,则需要使用 --force 参数。 执行git submodule deinit project-sub-1 命令的实际效果,是自动在...
git submodule [--quiet] add [] [--] [] git submodule [--quiet] status [--cached] [--recursive] [--] […] git submodule [--quiet] init [--] […] git submodule [--quiet] deinit [-f|--force] (--all|[--]…) git submodule [--quiet] update [] [--] […...
git submodule status 查看当前仓库的submodule状态,包括submodule的submodule状态(if you want to show nested submodules.): git submodule status --recursive 七. 更改submodule的版本 我一开始直接用的git submodule update --remote path-to-submodule的指令,cmd界面上成功走完了,没报错,但是我进去我的submodule...
# main目录下git submodule foreach git pull 我们对所有的子仓库拉取了一次最新的代码,foreach后面使用的就是你要对子模块使用的git命令。 那么还有一个问题,我们在修改了子仓库提交后,回到父级仓库执行git status后为什么git不像以前一样告诉我们具体的文件更新信息呢,而是给出了modified: lib (new commits)这样...
2.4 更新主项目的Submodules好的,让我们先进入project1目录同步仓库:henryyan@hy-hp ~/submd/ws/project1-b git:(master) cd ../project1 henryyan@hy-hp ~/submd/ws/project1 git:(master) git pullremote: Counting objects: 5, done.remote: Compressing objects: 100% (3/3), done.remote: Total...
git pull 默认情况下会跟踪子模块的 master 分支,设置为其他分支: a. .gitmodules 设置 git config -f .gitmodules submodule.[submodule-name].branch [branch-name] 如果不用 -f .gitmodules 选项,那么它只会为你做修改。但是在仓库中保留跟踪信息更有意义一些,因为其他人也可...
make sure to use a URL that they can access if possible. For example, if you use a different URL to push to than others would to pull from, use the one that others have access to. You can overwrite this value locally withgit config submodule.DbConnector.url PRIVATE_URLfor your own us...