Here's a suggested slight change to your desired deploy commands:
cd /var/www/
git clone /home/repo/.git newsite
git remote add mod1 /home/modules/mod1/.git
git remote add mod2 /home/moudles/mod2/.git
cd newsite
git merge mod1/master
git merge mod2/master
Explanation:
As you said, your main module (/home/repo) and your mod1
, mod2
etc. have the same folder structure. Submodules then aren't really appropriate since a submodule has to live in a subdirectory of your main repo. In this version, your local git repository (created by the clone
) knows about three remote repositories. After the merge
operations, its state won't be the same as any of them. The merge
of mod1 will bring in any new files "owned" by mod1. You may get merge conflicts if any files in home/repo
have the same name as those in mod1
, etc. You could supply a flag to merge
to select the version from mod1
always, which I believe you said is the behavior you want.