Created
August 16, 2011 10:49
-
-
Save dameninngenn/1148840 to your computer and use it in GitHub Desktop.
git log sum example
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
% git log --stat --author=dameninngenn --since="2011-07-15" --before="2011-08-15" --no-merges | grep 'files changed' | awk '{ins += $4}{del += $6} END{print "total: "ins"insertions(+) "del"deletions(-)"}' | |
> total: 3385insertions(+) 1089deletions(-) |
Bonus:
per authors in all branches
git log --all --since="11 days ago" --no-merges --pretty=format:%an | sort | uniq | xargs -I% -L1 bash -c 'echo $0; git log --all --stat --author="$0" --since="11 days ago" --no-merges | grep "files changed" | sed -E "s/d, ([[:digit:]]+) d/d, 0 insertions(+), \1 d/g" | awk '\''{ins += $4}{del += $6} END{print "total: "ins"insertions(+) "del"deletions(-)"}'\'';' "%"
Example output:
Tobi Myers
total: 409insertions(+) 76deletions(-)
Rangid Kouthrapalli
total: 1047insertions(+) 1165deletions(-)
Roger Seifert
total: 1013insertions(+) 2058deletions(-)
Vanessa Lambert
total: 71insertions(+) 34deletions(-)
Thank you for your opinion.
It seems great! Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great command except when there are commits with only deletions, then the parameter order is messed up and deletions count for insertions.
I use
sed
to add, 0 insertions(+)
when necessary and then the parameter order forawk
is restored.TL;DR: The fixed command would be:
% git log --stat --author=dameninngenn --since="2011-07-15" --before="2011-08-15" --no-merges | grep 'files changed' | sed -E 's/d, ([[:digit:]]+)/d, 0 insertions(+), \1/g' | awk '{ins += $4}{del += $6} END{print "total: "ins"insertions(+) "del"deletions(-)"}'