我想从我的git项目外运行子模块更新。对于大多数命令(例如
git status
),我可以给git传递--git-dir
和--work-tree
参数,如下所示:git --git-dir=/path/to/root/.git --work-tree=/path/to/root status
。然而,运行git --git-dir=/path/to/root/.git --work-tree=/path/to/root submodule update
会得到以下结果:fatal: $program_name cannot be used without a working tree.
我知道我可以切换到/path/to/root
目录,但我想知道git是否有能力从git项目外部更新子模块。