Вопрос

I've always been puzzled by this:

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

Why do I need to run it from the top level directory? Is it a technical reason, or just because of a convention / possible flaw ?

Это было полезно?

Решение

Note: since git 1.8.4 (August 2013), and commit 091a6eb, you don't have to be at top-level to run git submodule update.
This is because git rev-parse has a new --prefix option.

--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.

That same limitation is gone for git submodule add as well.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top