Skip to content

Instantly share code, notes, and snippets.

@innerfence
Created March 2, 2010 03:27
Show Gist options
  • Save innerfence/319097 to your computer and use it in GitHub Desktop.
Save innerfence/319097 to your computer and use it in GitHub Desktop.
namespace :git do
task :check_heads do
my_head = run_locally( 'git ls-remote . refs/heads/master' )
origin_head = run_locally( 'git ls-remote origin refs/heads/master' )
if my_head != origin_head
raise "Your master is not in sync with origin"
end
end
end
before 'deploy:update_code', 'git:check_heads'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment