1

I often use this pattern for easy deployment of websites:

I have a bare repo, which I push/pull to from my computer and this bare repo has a post-update hook that automatically does a pull in another repo (the live version).

However, if I add a submodule on my computer and push it, I have to manually connect to the remote and do the init/update.

Is there a way around it ?

Mat
  • 202,337
  • 40
  • 393
  • 406
sebastien
  • 418
  • 4
  • 7

1 Answers1

1

Do you have the ability to do more than a pull on the live server? You can do all of that in one (well, technically two) command:

git pull && git submodule update --init --recursive

This will recursively initialise and pull any submodules, and update existing submodules.

Hope that helps.

Jon Cairns
  • 11,783
  • 4
  • 39
  • 66
  • I would add something. `cd $(git rev-parse --show-toplevel) && git pull && git submodule update --init --recursive;`. The first command goes to the toplevel of the git folder tree. – J-Rou Mar 15 '12 at 20:18