From b73d3c8fb2039cb06be6a52d3a21dbc959f8f50c Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Tue, 24 Jun 2008 18:59:42 -0400 Subject: Adding forcefull pushing --- lib/git/base.rb | 4 ++-- lib/git/lib.rb | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index 6ce7efe..61b1f62 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -293,8 +293,8 @@ module Git # # @git.config('remote.remote-name.push', 'refs/heads/master:refs/heads/master') # - def push(remote = 'origin', branch = 'master') - self.lib.push(remote, branch) + def push(remote = 'origin', branch = 'master', opts = {}) + self.lib.push(remote, branch, opts) end # merges one or more branches into the current working branch diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 1aaf131..2998194 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -520,8 +520,12 @@ module Git command('fetch', remote.to_s) end - def push(remote, branch = 'master') - command('push', [remote.to_s, branch.to_s]) + def push(remote, branch = 'master', opts = {}) + arr_opts = [] + arr_opts << "--force" if opts[:force] + arr_opts << remote.to_s + arr_opts << branch.to_s + command('push', arr_opts) end def tag_sha(tag_name) -- cgit