Using capistrano to deploy from different git branches

This works with Capistrano >= 3.1:

add this line to config/deploy.rb:

set :branch, ENV['BRANCH'] if ENV['BRANCH']

and then call capistrano with:

cap production deploy BRANCH=master

This solution works with Capistrano < 3.1:

# call with cap -s env="<env>" branch="<branchname>" deploy

set :branch, fetch(:branch, "master")
set :env, fetch(:env, "production")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)