Merge many github repositories into one directory
I have many OpenCart-based e-shops and want to create deployment system for them. My idea is to pull github repositories step-by-step into one directory, for example:
- OpenCart from official repo
- Theme from my private repo
- Modules (can add or update files in /admin, /vqmod, /catalog dirs)
- Other changes
...and deploy it to production server.
Please advise me what is the best solution for that? Should I simply merge all repositories into one directory or use submodules?
It sounds like you just want to merge multiple repos and branches into your current branch.
First, add all the other repos as remotes:
git remote add official url_to_OpenCart_official_repo git remote add themes url_to_private_repo git remote add modules url_to_modules_repo
Then each time you need to do a release:
git checkout -b release/whatever git merge official/master themes/your_branch modules/your_branch git push origin -u release/whatever
After that complex a merge, you'll want to do some additional testing.
If you merge more than one branch at a time, an Octopus merge is attempted, meaning it will try to merge all branches specified as long as it can be done cleanly. If there are any merge conflicts, the merge will fail. I appears in your specific case that there are some merge conflicts. You'll have to merge the branches one at a time:
git merge official/master <resolve merge conflicts> git merge themes/your_branch <resolve merge conflicts> git merge modules/your_branch <resolve merge conflicts>
This other Stack Overflow question gives a good overview of the Git Merge Strategies and when to use them: When would you use the different git merge strategies?