Class: Thegarage::Gitx::Cli::CleanupCommand
- Inherits:
-
BaseCommand
- Object
- Thor
- BaseCommand
- Thegarage::Gitx::Cli::CleanupCommand
- Defined in:
- lib/thegarage/gitx/cli/cleanup_command.rb
Instance Method Summary collapse
Methods inherited from BaseCommand
Methods included from Thor::Actions
Constructor Details
This class inherits a constructor from Thegarage::Gitx::Cli::BaseCommand
Instance Method Details
#cleanup ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/thegarage/gitx/cli/cleanup_command.rb', line 10 def cleanup checkout_branch 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_branches(remote: true).each do |branch| run_cmd "git push origin --delete #{branch}" end merged_branches(remote: false).each do |branch| run_cmd "git branch -d #{branch}" end end |