Skip to content

Instantly share code, notes, and snippets.

@danielpietzsch
Created March 10, 2011 22:50
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danielpietzsch/865115 to your computer and use it in GitHub Desktop.
Save danielpietzsch/865115 to your computer and use it in GitHub Desktop.
Deploy a specific or the current Git branch by default using Capistrano
# 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
@gtd
Copy link

gtd commented Apr 21, 2018

`git rev-parse --abbrev-ref HEAD`.strip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment