Reputation: 809
I thought I had it all worked out with this new project and thought that git submodules are the way to to develop and deploy my application.
Set up my git repo (Drupal) and initialized it with the 7.12 tag of Drupal. Made my own branch. Then added the modules that are needed under sites/all/modules/contrib with git submodule add --branch 7.x git://path/to/drupal/module sites/all/modules/contrib/module
and then I thought, by pushing my repo to github, I would be able to simply pull it and then it would pull all the submodules into the deployment path. However, all my modules are not pulled, even if I do: git submodule foreach git pull or git submodule init followed by git submodule update
Turns out, I was wrong. Do I now need to redo everything in another way? If yes, please tell me how, if not, great, please let me know.
Upvotes: 55
Views: 58146
Reputation: 31950
If files for a submodule fail to be pulled, you could try deleting the folder for the submodule from your local repo. Then try
git submodule update
It should show you Submodule path <submodule-name>: checked out '<sha>'
.
Check, and your files should now be pulled.
If that fails, delete the folder and try:
git submodule update --init --recursive
git submodule update --recursive --remote
Upvotes: 7
Reputation: 57
If the submodule is not being pulled make sure you have added.
For example:
git submodule add https://github.com/chaconinc/DbConnector
I had the same issue and after running the above command it worked.
Upvotes: 0
Reputation: 13628
You forked the Drupal repo? Does it already have sub modules added in .gitmodules
? If so you only needed to clone their branch and perform
git submodule init
git submodule update
You don't need to re-add their own sub modules to the repo.
Now if you want to add additional submodules you have to perform git submodule init; git submodule update
every time you clone the repo. It will not automatically get the submodules.
Upvotes: 110