Joe Simpson Joe Simpson - 29 days ago 7
Git Question

Git submodule is returning blank?

I'm trying to use

git submodule update
and it's not returning anything, nor does any of the
git submodule
commands, and I have checked the
.gitmodules
file and it is correct?

I have no idea if git can be debugged or what, and it's really annoying.

There's no errors or anything, even when using
2>&1
on the end which is really worrying.

Answer

Remove any submodule entries from your .git/config. git rm --cached path/to/submodule to remove it from the tree. Make sure your working directory is clean. Now you can init the submodules:

git submodule init 

All this does is populate your config with the urls that are in the .gitmodules file. Now you can populate the submodules:

git submodule update

if your submodules have nested submodules, add the recursive option:

git submodule update --recursive

Init and update are separate for a good reason. You may want to have an alternate repository to store changes to you submodule.

Comments