Files
git-utilities/lib/feature/merge_to.rb
2015-06-06 06:43:34 -04:00

30 lines
731 B
Ruby

require_relative './base'
module Feature
class MergeTo < Feature::Base
def execute
parts = parse_branch(current_branch)
if argv.size == 2
merge_to_branch = argv[1]
elsif argv.size == 1
merge_to_branch = parts[:standard]
else
error "USAGE: feature merge [branch]"
end
feature_branch = current_branch
error "invalid branch: #{merge_to_branch}" unless standard_branches.include? merge_to_branch
run_cmd "git checkout #{merge_to_branch}"
run_cmd "git pull origin #{merge_to_branch}"
run_cmd "git merge #{feature_branch}"
run_cmd "git push origin #{merge_to_branch}"
run_cmd "git checkout #{feature_branch}"
end
end
end