Git子模块状态-如何在子模块中显示当前分支
使用以下命令检查主存储库中子模块的状态:Git子模块状态-如何在子模块中显示当前分支,git,git-submodules,Git,Git Submodules,使用以下命令检查主存储库中子模块的状态: git submodule status 生成输出(没有关于分支的明确信息): 是否可以检查子模块上的当前分支,而不使用: cd vendor/submodule1 git status cd ../submodule2 git status ? 此命令不起作用: git submodule status -b 答案隐藏在每个git子模块的中: git submodule foreach 'git status' 通过将此项分配给alias,始终
git submodule status
生成输出(没有关于分支的明确信息):
是否可以检查子模块上的当前分支,而不使用:
cd vendor/submodule1
git status
cd ../submodule2
git status
?
此命令不起作用:
git submodule status -b
答案隐藏在每个git子模块的
中:
git submodule foreach 'git status'
通过将此项分配给alias,始终可以使其更简单:
git config --global alias.sb "submodule foreach \"git status\""
现在,git sb
为您提供有关子模块中分支的详细信息:
Entering 'vendor/submodule1'
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Entering 'vendor/submodule2'
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
您可以运行git子模块status--recursive
它给
- 提交id
- 项目中子模块的路径
- 分支机构名称
Entering 'vendor/submodule1'
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Entering 'vendor/submodule2'
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean