Skip to content

Instantly share code, notes, and snippets.

@nedyalkov
Created August 9, 2019 20:26
Show Gist options
  • Save nedyalkov/c46bc780bc16621257250db412bcfce6 to your computer and use it in GitHub Desktop.
Save nedyalkov/c46bc780bc16621257250db412bcfce6 to your computer and use it in GitHub Desktop.
Get a contributions summary for an author prior to a date
AUTHOR=$1
FIRST_DAY=$2
echo "First contribution of $AUTHOR was done on: `git log --reverse --author="$AUTHOR" --until "$FIRST_DAY" -n 1 --pretty=%aI`"
CONTRIBUTIONS_SUMMARY=`git log --author="$AUTHOR" --pretty=tformat: --numstat --until "$FIRST_DAY" \
| awk '{ add += $1; subs += $2; loc += $1 - $2 } END \
{ printf "added lines(+): %s; removed lines(-): %s, total lines: %s\n", add, subs, loc }'`
echo "Contributions until $FIRST_DAY: $CONTRIBUTIONS_SUMMARY"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment