Last active
August 29, 2015 14:06
-
-
Save pbonnell/460190a9b78c3a78bcdd to your computer and use it in GitHub Desktop.
Ruby shell script to show what git branches contain the current release of a heroku app
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 | |
if ARGV[0].nil? | |
puts "List the local branches of a git repository that contain the most recent release of a heroku app." | |
puts "usage: released-from heroku-app-name" | |
exit | |
else | |
h = `heroku releases -n1 -a#{ARGV[0]}` | |
puts h | |
parsed = h.scan(/Deploy (.{7}) /).flatten[0] | |
unless parsed.nil? | |
puts "#{parsed} is on :" | |
exec("git branch --contains #{parsed}") | |
end | |
end | |
# mv ~/Downloads/released-from.rb /usr/local/bin/released-from | |
# chmod +x /usr/local/bin/released-from |
Author
pbonnell
commented
Sep 20, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment