Sha256: d66e264f79dd3597340e0a369e0844e4a7b56a1fc12b958170e39994cc75aa89
Contents?: true
Size: 960 Bytes
Versions: 7
Compression:
Stored size: 960 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_git_cmd 'share' end private def update_branch(branch) run_git_cmd 'pull', 'origin', branch rescue Gitx::Executor::ExecutionError raise MergeError, 'Merge conflict occurred. Please fix merge conflict and rerun the command' end def remote_branch_exists?(branch) repo.branches.each_name(:remote).include?("origin/#{branch}") end end end end
Version data entries
7 entries across 7 versions & 1 rubygems