Sha256: 24c341dad92e50410cf3280d89f4a5bfc5d258ac16a8671f91c7ff2f072bf0f2
Contents?: true
Size: 929 Bytes
Versions: 19
Compression:
Stored size: 929 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 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
19 entries across 19 versions & 1 rubygems