Created
February 28, 2019 06:08
-
-
Save xnuk/0208f6cee812e86986646e1a47cd18ef to your computer and use it in GitHub Desktop.
This file contains hidden or 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
set = Set.new ["HEAD"] | |
process = Process.new "git", args: [ | |
"for-each-ref", | |
"--count=100", | |
"--sort=-committerdate", | |
"refs/", | |
"--format=%(refname:short)", | |
"--no-merged=HEAD" | |
], output: Process::Redirect::Pipe | |
process.output.each_line do |l| | |
branch_name = l.strip.sub /^origin\//, "" | |
puts branch_name unless set.includes? branch_name | |
set << branch_name | |
end | |
exit process.wait.exit_code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment