Skip to content

Instantly share code, notes, and snippets.

@paulccarey
Created October 27, 2010 11:07
Show Gist options
  • Save paulccarey/648846 to your computer and use it in GitHub Desktop.
Save paulccarey/648846 to your computer and use it in GitHub Desktop.
capistrano select git branch
set :branch do
branches=`git branch -r | sed "1 d"`.split
branches.map { | b | b.gsub!("origin/","") }
puts "What branch would you like to deploy from?"
branches.each_index do | i |
puts((i+1).to_s + ": " + branches[i])
end
branch_index = Capistrano::CLI.ui.ask('Branch to deploy from?:').to_i
branches[branch_index-1]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment