0

I'm using git with bitbucket. I added some new submodules to git on my server with this command: git submodule add --name This did the job, then I pushed it to the bitbucket and it all looks good. But when I try to pull the changes from another server things are going wrong. from the other server I run: git pull and git submodule update, I get the changes in .gitmodule and it creates the folders of the submodule in the right place but they are empty!!!. I can't go in to every empty submodule and run pull from the folder because I don't always know what submodule are added(sometimes other developers add them.) I tried to add git submodule init before I run git submodule update but this didn't help.

Emma
  • 149
  • 2
  • 8
  • Is this not already answered in http://stackoverflow.com/questions/1030169/easy-way-pull-latest-of-all-submodules?rq=1 ? – Verhagen Oct 27 '15 at 06:20
  • no, I'm not talking about latest version of submodules but pulling new submodules that where not part of the code before. – Emma Oct 27 '15 at 06:25

1 Answers1

1

git pull --recurse-submodules && git submodule update --recursive

Read the Git Tools Submodules, for al the details.

Verhagen
  • 3,885
  • 26
  • 36
  • would this also update the submodule to there last version? because this is something I would need to avoid. – Emma Oct 27 '15 at 07:07
  • Probably better to use `git fetch --recurse-submodules` as a _pull_ represents _fetch_ and _merge_ combined. – Verhagen Oct 27 '15 at 07:09
  • I'm looking at git fetch --help and it says: BUGS Using --recurse-submodules can only fetch new commits in already checked out submodules right now. When e.g. upstream added a new submodule in the just fetched commits of the superproject the submodule itself can not be fetched, making it impossible to check out that submodule later without having to do a fetch again. This is expected to be fixed in a future Git version. if I understand this correctly this is exactly my problem so it would not help :( – Emma Oct 27 '15 at 07:37