Robert Audi Robert Audi - 1 year ago 87
Git Question

How do I add a submodule to a sub-directory?

I have a git repo in

with a bunch of submodules in it. I want to add a submodule in
, but when I run
git submodule add <>
in the
directory, I get the following error message:

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

So the question is: How do I add a submodule to the

Answer Source

You go into ~/.janus and run:

git submodule add <git@github ...> snipmate-snippets/snippets/

If you need more information about submodules (or git in general) ProGit is pretty useful.