Skip to content

Instantly share code, notes, and snippets.

@MachinesAreUs
Created February 12, 2016 18:37
Show Gist options
  • Save MachinesAreUs/7e81f44bb4b1efe17c57 to your computer and use it in GitHub Desktop.
Save MachinesAreUs/7e81f44bb4b1efe17c57 to your computer and use it in GitHub Desktop.
Github stats
git log --since=2015-12-01 --no-merges --pretty="%H,%ad,%an" --date=short --shortstat | sed '/^$/d' | awk -F ',' '
function toStats(line) {
files = 0; insertions = 0; deletions = 0;
split(line, tokens, ",");
for (i=0; i < length(tokens); i ++) {
split(tokens[i], items, " ");
if(match(tokens[i], "file")) {
files = items[1];
}
else if(match(tokens[i], "insertion")) {
insertions = items[1];
}
else if(match(tokens[i], "deletion")) {
deletions = items[1];
}
}
return files "," insertions "," deletions;
}
/[a-f0-9]{40},/ {
getline stats; print "front," $1 "," "https://github.com/VoxFeed/VoxFeed_Web/commit/" $0 "," toStats(stats)
}' > github_stats.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment