Last active
January 25, 2022 22:36
Git top contributors by file
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 | |
# | |
# Prints out top 5 contributors per file (as determined by # of commits) on every file in the repository | |
# | |
files = `git ls-files`.lines.map(&:chomp) | |
stats_by_file = {} | |
files.each_with_index do |file, index| | |
puts "On #{index+1} of #{files.length}: #{file}" | |
contributions = `git shortlog #{file} --summary --email --numbered`.lines.map(&:chomp) | |
stats_by_file[file] = contributions[0..4] | |
stats_by_file[file].each do |contribution| | |
puts " #{contribution}" | |
end | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment