Class: Gitx::Cli::CleanupCommand

Inherits:
BaseCommand show all
Defined in:
lib/gitx/cli/cleanup_command.rb

Instance Method Summary collapse

Methods included from Thor::Actions

#ask_editor

Instance Method Details

#cleanupObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gitx/cli/cleanup_command.rb', line 9

def cleanup
  checkout_branch config.base_branch
  run_git_cmd 'pull'
  run_git_cmd 'remote', 'prune', 'origin'

  say 'Deleting local and remote branches that have been merged into '
  say config.base_branch, :green
  merged_branches(remote: true).each do |branch|
    run_git_cmd 'push', 'origin', '--delete', branch
  end
  merged_branches(remote: false).each do |branch|
    run_git_cmd 'branch', '--delete', branch
  end
end