Ensure latest commits are pushed before deploy

 Feb 27, 2013

This is a task I add to my capistrano recipes to ensure that the branch being deployed is always pushed to the remote prior to deploy

task :push do
  unless system "git push development #{branch}"
    raise Capistrano::Error, 'Git push failed'
  end
end

and just add the task to your before callback

before "deploy", "push"