cho45 (owner)

Revisions

gist: 165746 Download_button fork
public
Public Clone URL: git://gist.github.com/165746.git
Embed All Files: show embed
show_recent_branches.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env ruby
 
branches = `git branch -a --no-abbrev --verbose`
branches.gsub!(/^\*?\s+/, "")
 
branches = branches.split(/\n/).map {|i| i.split(/\s+/) }
 
now = Time.now - (24 * 60 * 60 * 30)
 
branches.map {|name, hash, desc|
    time, author = *`git log -1 --pretty=format:'%ct %an' #{hash}`.split(/\s+/)
    [name, hash, desc, Time.at(time.to_i), author]
}.select { |_, _, _, time|
    time > now
}.sort_by { |_, _, _, time|
    time
}.each {|name, hash, desc, time, author|
    puts "#{time.strftime('%m-%d %H:%M')} #{hash[/^.{7}/]} \e[32m#{name}\e[m #{desc} \e[31m#{author}\e[m"
}