git submodule update 指定分支 文心快码 在Git中,git submodule命令用于管理项目中的子模块。子模块允许你将一个Git仓库作为另一个Git仓库的子目录。git submodule update命令用于更新子模块到在父仓库中指定的提交。如果你想让子模块更新到特定的分支,可以使用--remote选项结合--branch选项来实现。 以下是如何使用git...
你需要在 git pull 之后,调用 git submodule update 来更新 submodule 信息。这儿的坑在于,如果你 git pull 之后,忘记了调用 git submodule update,那么你极有可能再次把旧的submodule 依赖信息提交上去(使用 git submit -am "message" 或者 git add .提交的人会遇到这种事)。 参考 git子模块 git submodule(csdn...
这时候需要运行命令 git submodule init 去初始化本地配置文件以及 git submodule update 拉取代码。 $ git submodule init Submodule 'module/module1' (https:///xxx/subrepo1.git) registered for path 'module/module1' Submodule 'subrepo' (https:///xxx/subrepo.git) registered for path 'subrepo' $ g...
既然git远端服务器代码已经修改过了,那么本地每次执行了git submodule update --init --recursive命令后自然需要在自工程对应的路径下执行git pull命令,执行完后服务器端的最新代码就更新到本地了。这个操作做完后再执行git submodule update命令,此时就可以看到上边说的FETCH_HEAD文件中的commit id发生了变化,已经变为...
git rm --cached path_to_submodule (no trailing slash) 4.4 删除 .git/modules下面目录 rm -rf .git/modules/path_to_submodule (no trailing slash) 4.5 删除 子目录 rm -rf path_to_submodule 4.6 提交更改 git commit -am "Remove submodule" ...
git submodule update --init --recursive 可以看到,刚才删除的子模块再次被下载,并切换到相应的最新分支。 (5) 最后,输入查看本地分支状态的命令; git status 提示:nothing to commit,working tree clean. 翻译过来的意思就是:没有需要提交的代码,本地工作的树很干净,和远端仓库代码一致。
joern@hostname ~/tmp/example $ git add . joern@hostname ~/tmp/example $ git commit -m 'second commit' [master ec3abce] second commit 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100755 poc.sh 在克隆的存储库中,命令将在git pull之后运行git submodule update: ...
1.git pull之后,立即执行git status, 如果发现submodule有修改,立即执行git submodule update 2.尽量不要使用 git commit -a, git add命令存在的意义就是让你对加入暂存区的文件做二次确认,而 git commit -a相当于跳过了这个确认过程。 更复杂一些,如果你的submodule又依赖了submodule,那么很可能你需要在git pull...
在Git操作中,我们经常需要处理项目中嵌套的子项目,即子模块。git submodule update --init --recursive命令便是专门用于管理这些子模块的。此命令包含三个关键参数:update、--init 和 --recursive。update参数的目的是让Git更新子模块。若不指定update参数,Git仅会检查子模块是否在正确提交状态,而不会...
作为一个依赖多个子项目组成的项目,要实现直观的代码逻辑结构,可以考虑使用 Git submodule 特性。 当然,如果只是单独的依赖的话,用依赖管理即可,如Java 中的 Maven、Node.js 中的 npm、PHP 中的 composer。 给项目添加submodule 命令如下: git submodule add 仓库地址 路径 ...