Skip to content

Instantly share code, notes, and snippets.

@bAndie91
Created January 22, 2018 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bAndie91/66a74b22e24413eed43db81ebd39d784 to your computer and use it in GitHub Desktop.
Save bAndie91/66a74b22e24413eed43db81ebd39d784 to your computer and use it in GitHub Desktop.
display stats (first, last commit, num of commits, lines +/-) about each git author on the master branch
git log master --shortstat --format='commit %ct %aN' |\
perl -MDate::Format -ne '
if(/(\d+) insertion.* (\d+) deletion/){
$s{$N}->{"add"}+=$1;
$s{$N}->{"del"}+=$2;
$s{$N}->{"com"}++;
}elsif(/^commit (\d+) (.+)/){
$t=$1;
$N=$2; $N=~s/ /_/g;
if($first{$N}>$t or !$first{$N}){ $first{$N}=$t };
$last{$N}<$t and $last{$N}=$t;
}
END{
printf "%-50s %s %s\t%4d\t%5d\t%5d\n",
$_, time2str("%Y-%m-%d", $first{$_}), time2str("%Y-%m-%d", $last{$_}), $s{$_}->{"com"},$s{$_}->{"add"},$s{$_}->{"del"}
for keys %s;
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment