Created
November 22, 2013 04:51
-
-
Save carlwoodward/7595021 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
#!/usr/bin/env ruby | |
require "date" | |
class Branch < Struct.new(:name, :date) | |
end | |
branches = `git branch -a`.split("\n").map do |branch_name| | |
unless branch_name.include?("*") || branch_name.include?("->") | |
has_activity = `git log --abbrev-commit --date=short -1 #{branch_name}` | |
last_activity = `echo "#{has_activity}" | grep Date: | sed 's/Date: //'` | |
Branch.new branch_name, Date.parse(last_activity) | |
end | |
end.compact | |
branches.sort_by(&:date).each do |branch| | |
puts "#{branch.name} last activity was \033[1;31m#{branch.date.to_s}\033[0m" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment