Created
March 14, 2013 01:17
-
-
Save fpinzn/5158032 to your computer and use it in GitHub Desktop.
Bash script to generate stats, in the shape of a csv file. Each line is composed by the one-line git log of each commit and the number of lines of code tracked. Extracted from https://www.destroyallsoftware.com/screencasts/catalog/statistics-over-git-repositories
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/bash | |
set -e | |
function main { | |
git rev-list --reverse HEAD | | |
while read rev; do | |
echo "'`commit_description`', '`number_of_lines`'" | |
done > stats.csv | |
} | |
function commit_description { | |
git log --oneline -1 $rev | cat | |
} | |
function number_of_lines { | |
git ls-tree -r $rev | | |
awk '{print $3}' | | |
xargs git show | | |
wc -l; | |
} | |
MAIN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment