views:

87

answers:

2

I'm fairly new to git and just trying to put a submodule into a repo.

The problem is that when I clone the parent repo, the submodule folder is entirely empty.

Is there any way to make it so that 'git clone parent' actually puts data in the submodule folder?

example: http://github.com/cwolves/sequelize/tree/master/lib/

nodejs-mysql-native is pointing at an external git, but when I checkout the sequelize project, that folder is empty...

+3  A: 

You have to do two things before a submodule will be filled:

git submodule init 
git submodule update
LiraNuna
I was afraid of that... it doesn't make any sense since you're checking out a partial project in that case. I understand that the submodule updates aren't automatic, but why isn't the bound version automatically checked out?? Is there any way to force it? I have a project with 3-levels of submodules and it seems absurd to have to traverse that far just to do a checkout.
Mark
Please read the `git-submodule(1)` man page (http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html). You'll find out that `git submodule update` supports a nice parameter called `--recursive`.
joschi
A: 

As joschi mentions in the comments, git submodule now supports the --recursive option (Git1.6.5 and more).

If --recursive is specified, this command will recurse into the registered submodules, and update any nested submodules within.

See Working with git submodules recursively for the init part.
See git submodule explained for more.

With version 1.6.5 of git and later, you can do this automatically by cloning the super-project with the –-recursive option:

git clone --recursive git://github.com/mysociety/whatdotheyknow.git
VonC