Can I put a .gitmodules file in a subdirectory?
Let’s say my repo index root is in
.gitmodules also be inside this dir, or can I put it into, say
The reason I would like to do that is because I have multiple contributors and I want each to be responsible for his own set of submodules.
One Solution collect form web for “Can I put a .gitmodules file in a subdirectory?”
man gitsubmodule on Debian Wheezy says:
... SYNOPSIS $GIT_WORK_DIR/.gitmodules ...
According this default place for .gitmodules file is a top-level directory of the git working tree.
So, lets say you have such project structure:
project/ | |--subproject-1/ | `--.gitmodules |--subproject-2/ | `--.gitmodules |--.gitmodules
.gitmodules in your project root dir will define modules subproject-1 and subproject-2. Subprojects dependent modules also can be defined with subproject-N/.gitmodules, but those settings will affect only in proper subproject scope.
To update your project dependencies you should use command:
git submodule update
But if you want to update also dependencies of subproject-1 and subproject-2 use:
git submoudle update --recursive