Skip to content

Instantly share code, notes, and snippets.

View lmandel's full-sized avatar

Lawrence Mandel lmandel

View GitHub Profile
@jarthorn
jarthorn / merge-commits-by-date.rb
Created March 31, 2016 17:13
Print a histogram of merge commits by month for the current Git repository
#!/usr/bin/env ruby
TEMPFILE = "/tmp/git-merge-dates.txt"
`git log --merges --pretty=format:"%ci" --date=short > #{TEMPFILE}`
puts "MONTH,COMMITS"
(2011..2016).each do |year|
(1..12).each do |month|
pattern = year.to_s + "-" + sprintf("%02d", month)
result = `grep #{pattern} #{TEMPFILE} | wc -l`