You are viewing...

Using Git with a Dev/Staging/Production Workflow

Updated on February 13, 2012 at the 01th hour
Posted under:

DISCLAIMER: All views are considered my own and you should not draw any conclusions on associates.

Update: Here is how I did it. Setup dev/staging/production with git

Looks like I decided to attempt creating a private git repository on my server. It works, but that was after so much frustration is figuring out how to follow the workflow from my last SVN post. Essentially, I wanted a simple dev -> staging -> production workflow. Considering how I've done it so far, it is a little more complicated than I thought, well in git anyway.

I created a repository in a separate folder from the production directory, which contains a master and staging branch, then I cloned the staging branch into the staging directory on my server, so I could create a staging server on the same server. Reasoning for this is being able to test changes before I commit to production. I then have a symlink in the home directory of the user I am using pointing to staging's .git folder, so I could easily clone it to my local computers where I would create a development branch. :) I can now merge my dev branch into my staging branch and push it upstream. This great, but then problem is when I want to push upstream, I'd have to switch my server staging folder to the origin or head branch (which technically isn't a listed branch), so I can successfully push from my development server, then switch back to the staging branch and push upstream again. At this point I want to merge then push from staging to master, but unfortunately I have to go to my production folder to switch it from the master branch to something else in order to successfully push. It is slightly annoying and maybe people have a better way of doing this.

Any thoughts on how to fix this? also Hopefully, this helps anyone else who has been trying to do this.
You just read "Using Git with a Dev/Staging/Production Workflow". Please share if you liked it!
You can read more recent posts here.