We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2df31a7 commit c8f053aCopy full SHA for c8f053a
git-prune-remote-branch
@@ -0,0 +1,21 @@
1
+#!/usr/bin/env ruby
2
+require 'optparse'
3
+
4
+opts = OptionParser.new
5
+opts.on('--noop', 'dry-run mode') { |v| $noop = true }
6
+opts.parse!
7
8
+`git branch -r`.each_line do |branch|
9
+ branch.strip!.chomp!
10
+ next if branch =~ /origin\/master/
11
+ next if branch =~ /origin\/develop/
12
13
+ if `git branch --contains #{branch}`.each_line.any? { |included| included.strip.chomp =~ /\A(develop|master)\z/ }
14
+ ref = branch.sub(/^origin\//, '')
15
+ command = "git push --delete origin #{ref}"
16
+ puts command
17
+ unless $noop
18
+ system command
19
+ end
20
21
+end
0 commit comments