This is mostly a reminder for me as I couldn’t find an example online (I have notoriously bad Google-Fu) about deploying a different branch to the one you have set in your Capistrano deploy.rb file.
The command is very simple:
cap -s branch=branch_name deploy
I wanted to deploy to a staging environment so I did:
cap -s branch=branch_name staging deploy
It really is as simple as that.