class Rebaser::Rebaser
Attributes
branches[R]
failed_rebases[R]
rebase_branch[R]
remote[R]
successful_rebases[R]
Public Class Methods
new(branches, rebase_branch, remote)
click to toggle source
# File lib/rebaser/rebaser.rb, line 7 def initialize(branches, rebase_branch, remote) @branches = branches @rebase_branch = rebase_branch @successful_rebases = [] @failed_rebases = [] @remote = remote end
Public Instance Methods
begin()
click to toggle source
# File lib/rebaser/rebaser.rb, line 15 def begin checkout(rebase_branch) branches.each do |branch| checkout(branch) puts "Rebasing #{branch} onto #{rebase_branch}" output = attempt_rebase if output =~ /Automatic merge failed/ abort_rebase failed_rebases << branch elsif output =~ /did not match any file/ failed_rebases << branch else force_push(branch) successful_rebases << branch end end end
Private Instance Methods
abort_rebase()
click to toggle source
# File lib/rebaser/rebaser.rb, line 46 def abort_rebase system 'git rebase --abort' end
attempt_rebase()
click to toggle source
# File lib/rebaser/rebaser.rb, line 42 def attempt_rebase system "git rebase #{rebase_branch}" end
checkout(branch)
click to toggle source
# File lib/rebaser/rebaser.rb, line 38 def checkout(branch) system "git checkout #{branch}" end
force_push(branch)
click to toggle source
# File lib/rebaser/rebaser.rb, line 50 def force_push(branch) system "git push -f #{remote} #{branch}" end