首页 > 解决方案 > 无法在子模块根目录之外调用 git 函数是 git 子模块功能还是错误?

问题描述

git submodule foreach 'if echo "$sm_path" | grep just_this_one ; then git rev-parse HEAD ||:; fi'

git submodule foreach 'if echo "$sm_path" | grep just_this_one ; then cd somewhere; git rev-parse HEAD ||:; fi'

git submodule foreach 'if echo "$sm_path" | grep just_this_one ; then cd somewhere; git -C .. rev-parse HEAD ||:; fi'

这是错误还是功能?

如果我想运行这个命令,我该怎么做才能通过它: git submodule foreach 'make -C somewhere all' makefile 包含一些 git 函数调用。我还希望仍然能够在 git submodule foreach 之外调用 makefile。


$ git --version
git version 2.23.0

标签: gitgit-submodules

解决方案


推荐阅读