最近我用这个命令更新了我的 vim 配置库中的子模块:
git submodule update --recursive --remote
当我打电话时,git status
我得到了这个:
On branch master
Your branch is ahead of 'origin/master' by 5 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: .vim/pack/starter-pack/start/YouCompleteMe (modified content)
no changes added to commit (use "git add" and/or "git commit -a")
然后我跟踪了具有“修改内容”的子模块链,发现唯一的修改是子模块的未跟踪提交:
On branch master
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: vendor/bottle (new commits)
modified: vendor/jedi (new commits)
modified: vendor/waitress (new commits)
no changes added to commit (use "git add" and/or "git commit -a")
这些子模块(bottle、jedi、waitress)的主分支位于其远程来源的主分支之后,所以我认为git submodule update
所做的不仅仅是拉取每个 repo 的来源,而是找到父存储库所需的适当版本。
(new commits)
如果它是父模块需要的确切提交,为什么甚至 git 会标记这个 repos ?那里发生了什么?