Created
June 14, 2019 09:45
-
-
Save ezamelczyk/78b9c0dd095f8706a3f6a41e8eae0afd to your computer and use it in GitHub Desktop.
Git count lines by author
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
#!/bin/sh | |
git log --shortstat | grep -E "(Author: )(\b\s*([A-Z]\w+)){2}|fil(e|es) changed" | awk ' | |
{ | |
if($1 ~ /Author/) { | |
author = $2" "$3 | |
} else { | |
files[author]+=$1 | |
inserted[author]+=$4 | |
deleted[author]+=$6 | |
} | |
} | |
END { for (key in files) { print "Author: " key "\n\tfiles changed: ", files[key], "\n\tlines inserted: ", inserted[key], "\n\tlines deleted: ", deleted[key] } } | |
' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated version support for macOS without needing to install gdate utility