Created
April 1, 2013 05:36
-
-
Save iorionda/5283396 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'optparse' | |
opts = OptionParser.new | |
opts.on('--noop', 'dry-run mode') { |v| $noop = true } | |
opts.parse! | |
`git branch -r`.each_line do |branch| | |
branch.strip!.chomp! | |
next if branch =~ %r![^/]+/master! | |
next if branch =~ %r![^/]+/develop! | |
if `git branch --contains #{branch}`.each_line.any? { |included| included.strip.chomp =~ /\A[* ]*(develop|master)\z/ } | |
ref = branch.sub(%r!^([^/]+)/!, '') | |
command = "git push --delete #{$1}/#{ref}" | |
puts command | |
unless $noop | |
system command | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment