namespace :git do

  desc 'Deploy via git pull'
  task :pull do
    on roles :app do
      within release_path do
        execute :git, :checkout, '--', 'db/schema.rb', 'Gemfile.lock'
        execute :git, :checkout, (fetch(:branch) || fetch(:stage))
        execute :git, :pull
      end
    end
  end

end

namespace :git do

  desc 'Deploy via git pull'
  task :pull do
    on roles :app do
      within release_path do
        execute :git, :checkout, '--', 'db/schema.rb', 'Gemfile.lock'
        execute :git, :checkout, "origin/#{(fetch(:branch) || fetch(:stage))}"
        execute :git, :pull
      end
    end
  end

end

Solve the unknown branch problem
Solve the unknown branch problem
