Git will let you do what you need.
I would use one repository containing each subdomain as a branch, since in my experience this will allow you to move changes between subdomains in the easiest way.
I am going to assume a structure in which you have a core branch, and several subdomainX branches, each of which has its own local changes to support. I also assume that you have a develop branch where you make major changes.
There are several key actions you need to perform:
You have made development changes that should go to all subdomains
Pull changes from development to the kernel
git checkout core git merge develop
Apply changes to subdomain branches. For each subdomain, do
git checkout subdomainX git rebase core
or if you prefer mergers over discounts (I find this case too confusing, but others may not agree)
git checkout subdomainX git merge core
If you have many branches of a subdomain, I would do this script. This will result in the rearrangement of all local branches containing the "subdomain" in their name on core .
for i in $( git branch | cut -b 3- | grep subdomain ) ; do git checkout $i git rebase core end
You have made changes to the subdomain that you want to pull into all other subdomains
First you need the SHA of the change you want to apply (and check it if you haven't done so already).
Then you pull only this change to the development branch, and then to core
git checkout develop git cherry-pick THE_SHA_OF_YOUR_CHANGE git checkout core git merge develop
Then you just run the script above to push the change to all branches of the subdomain.
You have git some changes that should be rolled back everywhere
git checkout develop git revert THE_BAD_SHA git checkout core git merge develop
Then run the script.
You want to compare two subdomains.
If two branches are called subdomainA and subdomainB , you can do
git diff subdomainA subdomainB
You want to know what changes are happening in subdomainA, but not core - that is, local changes.
Changes to the files can be obtained:
git diff subdomainA core
Actual change set list
git log core..subdomainA
Distribution processing
There are two ways to deal with this:
- Create a small script to copy files for each branch (I would use
rsync to avoid copying existing files, etc.). The advantage of this is that it is fast and does not require git on the server on which you are deploying. - Make each subdomain file a copy of the git repository. Your script will then ssh for each window and pull / merge the files. The advantage of this is that you can make changes to live servers and easily transfer them back to your repository. The disadvantages include the fact that you need to create a
bare repository as a source for all repositories, and this will take up more space. (However, IMO advantages in this case outweigh the disadvantages, and this is the approach I would use).