Working with Git submodules without .gitmodules
I’m interested in the specific case where you manually place one Git repository inside another Git repository (either by using
git clone or by copy-pasting in the filesystem). I’ve noticed the following things happen when you do this:
- Git will save a pointer to a specific commit, like with a submodule.
Git will not allow you to modify the contents of the subproject from within the
superproject, like with a submodule.
git cloneon the superproject will not copy the subproject contents,
like with a submodule.
git submodulewill not work. It complains about .gitmodules not being
I would like to know:
What does .gitmodules do? It’s absence is the only obvious difference between a
manual copy like this and a true submodule.
- Is there any other difference I don’t know about?
- Does this manually-copied state have a special name?
Is there any way to override and/or work around effects 3 and 4? (IE: I want to
render the resulting repository fully usable)
One Solution collect form web for “Working with Git submodules without .gitmodules”
I think the only difference is a submodule has a relation with its parent. For instance, you can use
--recursive option when cloning to fetch all the submodules at a time. Otherwise, you’d have to fetch them all one by one.