Skip to content

Instantly share code, notes, and snippets.

@hfs
Created February 16, 2018 08:48
Show Gist options
  • Save hfs/e8265ed2df80e49280ac32a2840b8683 to your computer and use it in GitHub Desktop.
Save hfs/e8265ed2df80e49280ac32a2840b8683 to your computer and use it in GitHub Desktop.
Git statistics for repository per author: Get number of changed files, inserted and deleted lines
#!/bin/sh
git log --shortstat | perl -ne 'chomp; $author = $1 if m/^Author: (.*)/; if (m/(\d+) files? changed, (\d+) insertions.* (\d+) deletions/){ $files{$author} += $1; $insertions{$author} += $2; $deletions{$author} += $3 }; END { foreach $author (sort { $files{$b} <=> $files{$a} } keys %files) {printf("%s: %d files, %d insertions(+), %d deletions(-)\n", $author, $files{$author}, $insertions{$author}, $deletions{$author})}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment