我一直对此感到困惑:
$ git submodule
You need to run this command from the toplevel of the working tree.
为什么我需要从顶级目录运行它?是技术原因,还是仅仅因为约定/可能的缺陷?
最佳答案
注意:从 git 1.8.4(2013 年 8 月)开始,commit 091a6eb , 你不必在顶层运行 git submodule update
.
这是因为 git rev-parse
有一个新的 --prefix
选项。
--prefix <arg>
Behave as if git rev-parse was invoked from the
<arg>
subdirectory of the working tree.
Any relative filenames are resolved as if they are prefixed by<arg>
and will be printed in that form.
git submodule add
as well 没有同样的限制。 .
关于git submodule update - 为什么从顶层开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21856214/