3

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 ?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.