Created
March 31, 2016 17:13
-
-
Save jarthorn/a07ffd65bd2fd421a0e8019e58a6c6e0 to your computer and use it in GitHub Desktop.
Print a histogram of merge commits by month for the current Git repository
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 | |
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` | |
puts pattern + "," + result.strip | |
end | |
end | |
`rm #{TEMPFILE}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment