Sha256: 407bd3ebcddb31b246d25fa507f5461e566f5d9866a6ed0004ac43fd6a21aa9f
Contents?: true
Size: 946 Bytes
Versions: 9
Compression:
Stored size: 946 Bytes
Contents
require 'thor' require 'gitx' require 'gitx/cli/base_command' module Gitx module Cli class UpdateCommand < BaseCommand desc 'update', 'Update the current branch with latest changes from the remote feature branch and master' def update say 'Updating ' say "#{current_branch.name} ", :green say 'with latest changes from ' say config.base_branch, :green update_branch(current_branch.name) if remote_branch_exists?(current_branch.name) update_branch(config.base_branch) run_cmd 'git push origin HEAD' end private def update_branch(branch) run_cmd "git pull origin #{branch}" rescue raise MergeError, 'Merge Conflict Occurred. Please fix merge conflict and rerun the update command' end def remote_branch_exists?(branch) repo.branches.each_name(:remote).include?("origin/#{branch}") end end end end
Version data entries
9 entries across 9 versions & 1 rubygems