Viewing:
#! /usr/bin/env bash
summed_commits="0"
echo -n "Total commits "
total_commits="$(git rev-list --count HEAD)"
echo "$total_commits"
this_year=$(date +%Y)
twenty_years_ago=$(($this_year - 100))
for y in $(seq $this_year -1 $twenty_years_ago);
do
if [ "$total_commits" -eq "$summed_commits" ] ; then
break
fi
commits_in_year=$(git rev-list --count HEAD --since $y-01-01 --until $(($y + 1))-01-01)
summed_commits=$(($summed_commits+$commits_in_year))
if [ "$commits_in_year" -gt "0" ]; then
echo -n "${y: -2}:$commits_in_year "
fi
done
echo