Skip to content

Commit f5cb437

Browse files
committed
Allow remote repository names other than origin
1 parent 64c5680 commit f5cb437

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

git-prune-remote-branch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ opts.parse!
77

88
`git branch -r`.each_line do |branch|
99
branch.strip!.chomp!
10-
next if branch =~ /origin\/master/
11-
next if branch =~ /origin\/develop/
10+
next if branch =~ /[^\/]+\/master/
11+
next if branch =~ /[^\/]+\/develop/
1212

1313
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}"
14+
ref = branch.sub(/^(?<remote>[^\/]+)\//, '')
15+
command = "git push --delete #{$~[:remote]} #{ref}"
1616
puts command
1717
unless $noop
1818
system command

0 commit comments

Comments
 (0)