Created
July 28, 2011 11:00
-
-
Save soutaro/1111375 to your computer and use it in GitHub Desktop.
Ensure your remote branch is up to date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :deploy_via, :remote_cache | |
set :branch, "release" | |
namespace :git do | |
namespace :ensure do | |
desc "Check if your local branch is synched with remote branch" | |
task :pushed do | |
local = `git rev-parse #{branch}`.chomp | |
remote = `git rev-parse remotes/origin/#{branch}`.chomp | |
unless local == remote | |
abort "ABORTING:: You have local commits\n\t#{branch} => #{local}\n\tremotes/origin/#{branch} => #{remote}" | |
end | |
end | |
end | |
end | |
before :deploy, "git:ensure:pushed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment