Protect yourself from unpushed files
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"
Original snippet written by Michael Ivey
Last updated at 17:43 PM on Feb 02, 2009
by Brian Hogan