0

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:

  1. OpenCart from official repo
  2. Theme from my private repo
  3. Modules (can add or update files in /admin, /vqmod, /catalog dirs)
  4. 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?

Thanks!

Vitali V.
  • 157
  • 1
  • 1
  • 9
  • From my experience, using github, submodules creates a directory. So unless it fits your need, I would simply go for a script that pull the repositories each in their own folder, then copy them into another one. Not a sexy solution though. – Micka Feb 03 '14 at 15:31
  • Micka, unfortunately OpenCart modules add files to many directories, 90% of them don't overwrite existing files but add new files. – Vitali V. Feb 03 '14 at 16:15

1 Answers1

1

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?

Community
  • 1
  • 1
Greg Burghardt
  • 17,900
  • 9
  • 49
  • 92
  • When merging "git merge official/master themes/master" it throws an error - fatal: Can merge only exactly one commit into empty head. Before that I should do "git pull official master" "git fetch official". And then getting "fatal: themes/master - not something we can merge" – Vitali V. Feb 04 '14 at 07:48