I just cloned a repository into a subdirectory of another repository, and git actually appeared to handle the situation pretty intelligently. I know about submodules, but I thought they always had to be explicitly defined and I didn't think git had this functionality. What happened?
Here's my shell session:
The second repository is being handled as a submodule by the first repository. Since you haven't defined it as a submodule though, you can not interact with it using the
git submodule
command, but all other commands treat it as a submodule.It handles it as a nested repository, not as a submodule.
As you found out, to declare it as a submodule:
.gitmodules
file (not tested)That will allow for the creation of the special entry in the git index referencing the submodule SHA1, as shown here, and detailed in the SO question "Nested git repositories without submodules?".