次のRubyスクリプトを使って、あるリポジトリの2020年のGitコミット数を月単位で集計します。
require 'date' 1.upto(12) do |i| start_date = Date.new(2020, i, 1) end_date = (start_date >> 1) - 1 commits = `git log --oneline --since #{start_date} --until #{end_date} | wc -l` puts "#{i}, #{commits.chop.to_i}" end
結果は次のとおりです。
1, 60 2, 76 3, 32 4, 45 5, 19 6, 53 7, 47 8, 57 9, 138 10, 482 11, 432 12, 432
gnuplotを使ってグラフにします。
gnuplot> plot "./commits.dat" with line
10月からコミット数が通常の3倍に増えていました。