Sha256: 9f73ab6dc30158664fca38dbbb9eb4152f59b7303876c2b1fc482cfd7250ca6e
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'thor' require 'thegarage/gitx' require 'thegarage/gitx/cli/base_command' module Thegarage module Gitx module Cli class CleanupCommand < BaseCommand desc 'cleanup', 'Cleanup branches that have been merged into master from the repo' def cleanup run_cmd "git checkout #{Thegarage::Gitx::BASE_BRANCH}" run_cmd "git pull" run_cmd 'git remote prune origin' say "Deleting local and remote branches that have been merged into " say Thegarage::Gitx::BASE_BRANCH, :green merged_remote_branches.each do |branch| run_cmd "git push origin --delete #{branch}" end merged_local_branches.each do |branch| run_cmd "git branch -d #{branch}" end end end private def merged_local_branches branches(:merged => true).reject { |b| aggregate_branch?(b) } end def merged_remote_branches branches(:merged => true, :remote => true).reject { |b| aggregate_branch?(b) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thegarage-gitx-2.0.0.pre1 | lib/thegarage/gitx/cli/cleanup_command.rb |