To a parent project, a submodule is essentially a subdirectory in your project that is viewed by the parent repo as a simple text file with a name and a commit number. So, when you pull down a project that uses submodules:
git submodule add <path to repo>
It will add that sub directory and an entry to its .gitmodules file (with the name and commit number). So when you git add .
and git commit -am 'message'
in the parent repo, the only thing you are adding and committing is the current commit of the submodule.
The git submodule
command is how to work beyond this narrow view of a text file with a commit message. As shown above, you would use git submodule add <path to repo>
to ADD it, but all you're adding is the text file with a name and commit. To actually pull down the files, you would run:
git submodule update --init --recursive