I have a GIT repository and I want to calculate how many lines of code were added/changed by one person or a group of persons during some period of time. Is it possible to c
You can generate stats using Gitstats. It has an 'Authors' section which includes number of lines add/removed by the top 20 authors (top 20 by commit count).
Edit: There's also Git: Blame Statistics
I'm not sure the line of code would be a good metric but if you are looking for just total commits and compare it against other engineers then you could use this: no plugin or addon is needed...just pure shell script, it was tested in zshell
Note: you must run this from the repo folder
#!/bin/env zsh
team_total=$(git shortlog -s -n |sed 's/\t/,/g'|cut -f1 -d, |bc -l|awk '{sum+=$1}END{print sum}');
tmp_counter='/tmp/counter.txt';
tmp_user='/tmp/users.txt';
tmp_percentage='/tmp/counters_users'
# if you are running this again it make the file empty or you can rm it
rm $tmp_percentage $tmp_user $tmp_counter
git shortlog -s -n |sed 's/\t/,/g'|cut -f2 -d, >>$tmp_user;
git shortlog -s -n |sed 's/\t/,/g'|cut -f1 -d, >>$tmp_counter;
cat $tmp_counter | while read LINE; do
printf '%.2f %% \n' $(echo \($LINE/$team_total\)\*100 |bc -l ) >>$tmp_percentage
done
echo 'commits % | contributor | # of commits';paste $tmp_percentage $tmp_user $tmp_counter
here is the sample report: