Q:

git submodule foreach not working

I want to figure out why git submodule foreach command is not working for me. I have cloned a git repository which has several submodules. I wanted to init and update all submodules at once to pull down the submodules sources. But whatever I try git submodule foreach is not working for me... I tried several things:
git submodule foreach init
git submodule foreach update
git submodule foreach update --init
git submodule foreach --recursive git submodule update --init

Every command will execute but without any output... If I go and init/update each module separately (without using foreach) then no problem.
Any ideas? 

A:

git submodule init or git submodule update are supposed to work for all submodules registered in .gitmodules, so it doesn't make sense to execute them for each submodules.
If you had submodules within submodules, git submodule update --recursive would take care of all submodules recursively.

A:

After a clone all you usually need to do is:
git submodule update --init --recursive

After this is done initially, you drop the --init option.
The init option is the part of the command that copies the url specified in the .gitmodules file down into the submodule repo configuration. You may not want to do this if you are using a particular remote of choice and the project has move to one you don't want to use. A typical case of this is when you would rather use your fork of a project on GitHub and the top level repo points to the main one.

