git submodule update - 为什么要从顶层更新子模块?

3

我一直对这个感到困惑:

$ git submodule
You need to run this command from the toplevel of the working tree.

为什么我需要从顶层目录运行它?这是技术原因,还是只是惯例/可能存在的缺陷?
1个回答

2
注意:自 git 1.8.4(2013年8月)以来,以及提交记录091a6eb之后,您不必在顶层运行git submodule update
这是因为{{link2:git rev-parse}}有了新的--prefix选项。
--prefix <arg>

假定从工作树的 <arg> 子目录中调用了 git rev-parse。
任何相对文件名都将被解析为前缀为 <arg> 并以该形式打印。
同样的限制也适用于 git submodule add

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接