Skip to content

Instantly share code, notes, and snippets.

@jherdman
Forked from danielpietzsch/deploy.rb
Created June 17, 2013 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jherdman/5796185 to your computer and use it in GitHub Desktop.
Save jherdman/5796185 to your computer and use it in GitHub Desktop.
# parses out the current branch you're on. See: http://www.harukizaemon.com/2008/05/deploying-branches-with-capistrano.html
current_branch = `git branch`.match(/\* (\S+)\s/m)[1]
# use the branch specified as a param, then use the current branch. If all fails use master branch
set :branch, ENV['branch'] || current_branch || "master" # you can use the 'branch' parameter on deployment to specify the branch you wish to deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment