Help with Git Workflow

Please help me out with this workflow:

Two main branches, one for each virtual server.

Pushing to master sends changes on to live;

Pushing to dev/stage (or whatever you call it) sends changes to staging;


Create branch from dev;

work locally until you're ready to test;

merge back to dev;

push to Hub, which sends changes to dev/staging server.

Once you’re ready with those to go live:

merge from dev to master,

then push master to Hub, which sends those changes on to the live server.

So one repo without two dirs, two branches, and his script is deploying each branch to a different hostname.

By taking this into consideration I’m not getting this:
Were should that prime repository be ?

  • On neither of those directories, on one of them ? Thanks a lot again.

Pushing to repo doesn’t push it “live”.

Pushing to repo merely does half the process.

Once you are ready to go live, you need to pull from the live server.

For example, we have a and a

On dev, we might branch and test various things, then once we’re done, we merge back to master and push it to github. You generally don’t need to branch though - this is primarily to test things concurrently with the master branch, you can work just off the master and push/pull as needed.

Once you are happy with the updates and want to push it live, that’s when we merely do a “git pull origin master” from the live server.

Not sure if that answers your question.

An example work flow is how my company does it:

We have 2 dev sites, a staging server (all on same server) and a live server (separate server).

we clone 3x, 2 dev and 1 staging.

dev1 makes changes.
dev1 commits then pushes to origin master

dev2 pulls origin master
dev2 makes changes
dev2 commits then pushes to origin master

(This goes on and on while the devs work on the project)

Once the devs are done, from the staging server, git pull origin master.

Now the staging is the latest version. We show to client/bosses/qa testing, etc till it’s approved.

Once approved, from the live server, we do a git pull origin master.

Then more changes come in, the cycle repeats.

Hope that gives you a better picture of the workflow, also note that different companies will do it differently.

How do you use databases in your workflow, if dev1 dev2 need to make changes to the structure?

I will give it a try at let you know what I end up with. Thanks again
@cw6365: Is question directed to the op ?
On this case, stage and production will share the same db schema.
If a major structure change arrive, yes we may not have the benefit of having it back on this workflow I suppose.
Place a db schema under version control seems to be, on lamp applications a little bit tricky.
Do you suggest something else?

It’s not trivial, but it seems like dbdeploy could do a nice job. You can also integrate that with [URL=“”]phing or your CI server if you have one (like [URL=“”]Jenkins).