Skip to content

Instantly share code, notes, and snippets.

@brianjriddle
Created April 25, 2012 08:36
Show Gist options
  • Save brianjriddle/2488228 to your computer and use it in GitHub Desktop.
Save brianjriddle/2488228 to your computer and use it in GitHub Desktop.
what happened and when in a git repo
#!/usr/bin/env ruby
git_dir=ARGV[0].nil? ? "." : ARGV[0]
since=ARGV[1].nil? ? 7: ARGV[1]
git_log = ""
Dir.chdir(git_dir) do
git_log = %x{git log --since="#{since} days ago" --format=%an | sort | uniq -c}
end
git_data = git_log.split("\n")
total_authors = git_data.size
total_commits = 0
git_data.each do |data|
commits, author = data.split("\s")
total_commits += commits.strip.to_i
end
puts "In the last #{since} days #{total_authors} developers have made #{total_commits} commits to #{git_dir}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment