Ecco un semplice script Ruby che ho usato per ottenere autore, linee, linee rimosso, e commit count from git. Non copre i commit nel tempo.
Nota che ho un trucco in cui ignora qualsiasi commit che aggiunge/rimuove più di 10.000 righe perché presumo che si tratti di un'importazione di codice di qualche tipo, sentiti libero di modificare la logica per le tue esigenze. È possibile inserire il seguito in un file chiamato gitstats-simple.rb e quindi eseguire
git log --numstat --pretty='%an' | ruby gitstats-simple.rb
contenuto di gitstats-simple.rb
#!/usr/bin/ruby
# takes the output of this on stdin: git log --numstat --prety='%an'
map = Hash.new{|h,k| h[k] = [0,0,0]}
who = nil
memo = nil
STDIN.read.split("\n").each do |line|
parts = line.split
next if parts.size == 0
if parts[0].match(/[a-z]+/)
if who && memo[0] + memo[1] < 2000
map[who][0] += memo[0]
map[who][1] += memo[1]
map[who][2] += 1
end
who = parts[0]
memo = [0,0]
next
end
if who
memo[0]+=line[0].to_i
memo[1]+=parts[1].to_i
end
end
puts map.to_a.map{|x| [x[0], x[1][0], x[1][1], x[1][2]]}.sort_by{|x| -x[1] - x[2]}.map{|x|x.inspect.gsub("[", "").gsub("]","")}.join("\n")
fonte
2013-09-14 03:12:28
Questo è esattamente quello che stavo cercando. Incredibile che sia possibile sostituire le righe di codice nel mio esempio con "git shortlog -sn" Vota questa risposta –
anche "git shortlog -sn --no-merges" rimuovi "merge commit" dal conteggio. – lbolla
febbraio 2010: [Attacchi Linus!] (Http://gitstats.sourceforge.net/examples/git/authors.html#cumulated_added_lines_of_code_per_author) – naught101