'New git submodule missing everytime I checkout my repo/branch
Whenever I clone my repo (<my_repo>
) locally, the new submodule's directory (under <my_repo>/_includes/<NEW_submodule_2>
) is empty.
I have added in my <NEW_submodule_2>/.gitmodules
like so:
[submodule "_includes/<submodule_1>"]
path = _includes/submodule_1
url = https://github.com/<my_org>/submodule_1
branch = master
[submodule "_includes/<NEW_submodule_2>"]
path = _includes/<NEW_submodule_2>
url = https://github.com/<my_org>/<NEW_submodule_2>
branch = master
I have to always run the following to get that directory populated: git submodule update --init --remote _includes/<NEW_submodule_2>
How do I fix this so that this command doesn't have to be run everytime I git clone (or whenever someone else clones)?
Solution 1:[1]
You could use one command: git clone --recurse-submodules
git clone --recurse-submodules=_includes/<NEW_submodule_2>
But both submodule1 and 2 should be empty after a regular clone.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | VonC |