Git Workflow With Capistrano

Posted by jerhinesmith on Stack Overflow See other posts from Stack Overflow or by jerhinesmith
Published on 2011-01-10T17:59:07Z Indexed on 2011/01/10 18:53 UTC
Read the original article Hit count: 299

Filed under:
|
|

I'm trying to get my head around a good git workflow using capistrano. I've found a few good articles, but I'm either not grasping completely what they're suggesting (likely) or they're somewhat lacking.

Here's kind of what I had in mind so far, but I get caught up when to merge back into the master branch (i.e. before moving to stage? after?) and trying to hook it into capistrano for deployments:

  1. Make sure you’re up to date with all the changes made on the remote master branch by other developers
    • git checkout master
    • git pull
  2. Create a new branch that pertains to the particular bug you're trying to fix
    • git checkout -b bug-fix-branch
  3. Make your changes
    • git status
    • git add .
    • git commit -m "Friendly message about the commit"

So, this is usually where I get stuck. At this point, I have a master branch that is healthy and a new bug-fix-branch that contains my (untested -- other than unit tests) changes.

If I want to push my changes to stage (through cap staging deploy), do I have to merge my changes back into the master branch (I'd prefer not to since it seems like master should be kept free of untested code)? Do I even deploy from master (or should I be tagging a release first and then modifying my production.rb file to deploy from that tag)? git-deployment seems to address some of these workflow issues, but I can't seem to find out how on earth it actually hooks into cap staging deploy and cap production deploy.

Thoughts? I assume there's a likely canonical way to do this, but I either can't find it or I'm too new to git to recognize that I have found it.

Help!

© Stack Overflow or respective owner

Related posts about git

Related posts about deployment