I have one repo hosted at https://github.com/aikiframework/json . On my local copy, I added a submodule using the command
git submodule add [email protected]:jcubic/json-rpc.git json-rpc
Then I did a commit and push, and the changes appear on GitHub (I can click on it). But when I clone the repo
git clone https://github.com/aikiframework/json.git
the submodule folder json-rpc is empty.
What am I missing here? Did I forget about something? Why is that folder empty?
It automatically pulls in the submodule data assuming you have already added the submodules to the parent project. Note that --recurse-submodules and --recursive are equivalent aliases.
You can fix it by: either committing or undoing the changes/evolutions within each of your submodules, before going back to the parent repo (where the diff shouldn't report "dirty" files anymore). To undo all changes to your submodule just cd into the root directory of your submodule and do git checkout .
This is because of some major drawbacks around git submodules, such as being locked to a specific version of the outer repo, the lacking of effective merge management, and the general notion that the Git repository itself doesn't really know it's now a multi-module repository.
OK I found it, needed to add --recursive
when cloning the repo.
So the clone command ends up as:
git clone https://github.com/aikiframework/json.git --recursive
Note that if you forgot the --recursive
flag you can do (thanks to @Amber):
git submodule update --init
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With