I'm just learning git and its basic fundamentals. I've got a live Magento store running and need to version control it asap. I've got git loaded on my work machine and have played around with setting up repositories, adding, committing and pushing files. I've tested my setup with Assembla and a free account (for now) and all is good.
I am still having trouble going about the physical changes though. I want to achieve the following (I think!):
So there's several important questions I need help with here.
Some helpful background for our store/project:
I would be thrilled if someone could point out a guided tutorial or similar for people like me who did everything backwards and now don't have the time to learn git one step at a time.
What's the process of sending a repo to a live site?
Git does not have a facility for this built in. You'll want to write a script that periodically (say, every five minutes) or on demand pulls some branch from your central repo. (I'm assuming you have a Git server somewhere that functions as such.)
You can do the same thing for the production environment, by having the staging server pull, say, master
, and having the production server pull the branch production
.
@larsmans has some pretty solid advice for you - I figured I'd cover your other points to try to help you out.
Think of your dev
server as where you (and possibly other developers) make, test, and finalize changes. Think of the stage
server as where you show potential changes to other stakeholders before they go to the production
or live site.
I personally use a branch for each server (we even specify local machines as alpha
servers before they even go to dev
/staging
), and think of them hierarchically:
Changes start in alpha
and are merged upwards - so a bugfix that starts in alpha
is merged or cherry-picked
into dev
, checked, then pushed upwards to stage
and ultimately to prod
. To update, the branches are just pulled
and synced that way. Each server has a copy of the repo, giving extra redundancy in the case of any issues.
We have our own git repository using gitolite
, which we've (easily) customized to handle the push
and pull
duties described in @larsman's answers - unfortunately, since you're on a shared host, this might not be the ideal solution for you. Either way, you should consider running a VPS, as Magento is very resource-intensive and load times suffer greatly - this is first hand advice from someone who has tried to make Magento work on HostGator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With