Reputation: 107
I want to nest 2 git repos. I have been reading into submodules and for a while i thought it was great, I think I may want something else. Here is my situation:
First I think I should mention that all of my servers host websites and are setup in a staging.domain.com and domain.com (live) pattern.
In each server I have a parent repo that is a website and a child repo which it my core library. I need my core to be the same on all of my servers but the website repos will all be unique to the server where they live. I want to write changes to the core, push to all staging domains simultaneously, then do some quality assurance, and push to all live servers.
I originally though that submodules would meet my needs but the issue I have with them is that I need the cores to update all at once. If I use submodules my core will update but won't take affect until the parent website runs git submodule update and git commit.
I figure why not just use a gitignore to ignore the folder that the core is in and treat them like they're separate entities. Has anyone else done this? What problems will I run into? Do you have any better suggestions?
Thank you in advance.
Upvotes: 2
Views: 279
Reputation: 5693
It depends on whether you want "git status" on the parent repo to return that the repo is clean. If you can live with "git status" on the parent repo returning something like "Untracked files:... core-libraries/", then you can just have the core-libraries repo as an untracked child of the parent repo.
Git really doesn't care about untracked files & directories.
Upvotes: 0
Reputation: 97282
Instead of submodules you can use git-subtree (Sample of usage)
Upvotes: 2
Reputation: 1324043
It seems you might benefit from a post-receive commit on your staging server, on which you could:
git submodule update
for all the staging sites
cd
to one server site /path/staging/site1
GIT_DIR=/path/staging/site1/.git WORK_TREE=/path/staging/site1/.git git submodule update
The idea would be:
Upvotes: 2