Skip to content

Instantly share code, notes, and snippets.

@kohlerm
Last active October 31, 2019 12:42
Show Gist options
  • Save kohlerm/145dfb5f088bedecc9e5dd4e38d666c3 to your computer and use it in GitHub Desktop.
Save kohlerm/145dfb5f088bedecc9e5dd4e38d666c3 to your computer and use it in GitHub Desktop.
Git nr of commits per year
find . -maxdepth 1 -type d -printf '%f\n' | parallel "git -C {} rev-list --count --since='Jan 1 2017' --before='Jan 1 2018' --all --no-merges;echo {}" >2017.txt
find . -maxdepth 1 -type d -printf '%f\n' | parallel "git -C {} rev-list --count --since='Jan 1 2018' --before='Jan 1 2019' --all --no-merges;echo {}" >2018.txt
find . -maxdepth 1 -type d -printf '%f\n' | parallel "git -C {} rev-list --count --since='Jan 1 2019' --before='Jan 1 2020' --all --no-merges;echo {}" >2019.txt
#!/bin/bash
pushd $1
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 "" key " ,", files[key], " ,", inserted[key] - deleted[key] } }
'
popd >/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment