Skip to content

Instantly share code, notes, and snippets.

@zabetak
Last active October 9, 2020 21:50
Show Gist options
  • Save zabetak/413cf1538ca9b026622e62596e094f6e to your computer and use it in GitHub Desktop.
Save zabetak/413cf1538ca9b026622e62596e094f6e to your computer and use it in GitHub Desktop.
Count the number of commits per quarter having a message that ends up with parentheses and certain specific characters
#!/usr/bin/env bash
for (( year=$1; year<=$2; year++ ))
do
echo -n "Q1 $year:"
git log --oneline --after="$year-01-01" --until="$year-04-01" | grep "([[:alnum:] ,\.]\+)$" | wc -l
echo -n "Q2 $year:"
git log --oneline --after="$year-04-01" --until="$year-07-01" | grep "([[:alnum:] ,\.]\+)$" | wc -l
echo -n "Q3 $year:"
git log --oneline --after="$year-07-01" --until="$year-10-01" | grep "([[:alnum:] ,\.]\+)$" | wc -l
echo -n "Q4 $year:"
git log --oneline --after="$year-10-01" --until="$((year+1))-01-01" | grep "([[:alnum:] ,\.]\+)$" | wc -l
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment