title: Capistrano can't deploy from non-master branch
body: <p>I'm using Capistrano (3.7.1) to deploy my Rails 5 application to a VPS. I have 2 major branches I'm using in git: <code>master</code>, for stable, production-ready code, and <code>develop</code>, for WIP code. I wanted to deploy the <code>develop</code> branch to a staging server, but it doesn't seem to be working.</p>
  
  <p><strong>In <code>deploy.rb</code>:</strong></p>
  
  <pre><code># This is the failing task
  task :check_revision do
    on roles(:app) do
      unless 'git rev-parse HEAD' == "git rev-parse origin/#{fetch(:branch)}"
        puts "WARNING: HEAD is not the same as origin/#{fetch(:branch)}"
        puts 'Run `git push` to sync changes.'
        exit
      end
    end
  end
  </code></pre>
  
  <p><strong>In <code>production.rb</code>:</strong></p>
  
  <pre><code>set :branch, 'master'
  </code></pre>
  
  <p><strong>In <code>staging.rb</code>:</strong></p>
  
  <pre><code>set :branch, 'develop'
  </code></pre>
  
  <p>Every time I try to deploy, it's failing, as follows:</p>
  
  <pre><code>$ cap staging deploy
  ... initial steps, skipped over ...
  WARNING: HEAD is not the same as origin/develop
  Run `git push` to sync changes.
  </code></pre>
  
  <p>But this is clearly not the case, as I'm getting:</p>
  
  <pre><code>$ git rev-parse HEAD
  38e4a194271780246391cf3977352cb7cb13fc86
  $ git rev-parse origin/develop
  38e4a194271780246391cf3977352cb7cb13fc86
  </code></pre>
  
  <p>which are clearly the same.</p>
  
  <p>What's going on?</p>