namespace :git do task :unpushed do ahead = `git log origin/#{branch}..#{branch} --pretty=oneline --abbrev-commit` unless ahead == "" puts "Whoa, hoss. Looks like you forgot to push the following SHAs:" puts ahead print "Continue with the deploy anyway? [y/N] " if $stdin.gets.chomp.upcase != "Y" puts "Good call. `git push` and come back." exit end end end end before "deploy:update_code", "git:unpushed"