def rebase_all_branches
col_width = branches.map { |b| b.name.length }.max + 1
branches.each do |branch|
remote = remote_map[branch.name]
curbranch = branch.name.ljust(col_width)
if branch.name == repo.head.name
print curbranch.bold
else
print curbranch
end
if remote.commit.sha == branch.commit.sha
puts "up to date".green
next
end
base = merge_base(branch.name, remote.name)
if base == remote.commit.sha
puts "ahead of upstream".green
next
end
if base == branch.commit.sha
puts "fast-forwarding...".yellow
elsif config("rebase.auto") == 'false'
puts "diverged".red
next
else
puts "rebasing...".yellow
end
log(branch, remote)
checkout(branch.name)
rebase(remote)
end
end