how to know if repository is a submodule

Pretend that I have repo A, and its submodules A.1 and A.2.

If I run

git clone --recursive .

It will clone the main repository and its submodules.

But if I run:

git clone --recursive .

I can't run anything that can handle the main repo and other submodules?


  • You cannot know whether a repository is a submodule or not. Each repository used as a submodule somewhere else is a full own standalone repository. That it is used in some other repository as submodule is purely defined by that master repository (or repositories). You can use one repository also as submodule repository for an arbitrary amount of master repositories. This is like asking "How do I know that package java.util.regex is used by other packages" or "How do I know that log4j is used by other software as library".