Skip to content

Instantly share code, notes, and snippets.

@mikezter
Created January 13, 2012 14:32
Show Gist options
  • Save mikezter/1606505 to your computer and use it in GitHub Desktop.
Save mikezter/1606505 to your computer and use it in GitHub Desktop.
Extract a a git-log for each month
#/bin/bash
year=2011
function header {
begin='Tätigkeiten '
case $1 in
1) month='Januar ';;
2) month='Februar ';;
3) month='März ';;
4) month='April ';;
5) month='Mai ';;
6) month='Juni ';;
7) month='Juli ';;
8) month='August ';;
9) month='September ';;
10) month='Oktober ';;
11) month='November ';;
12) month='Dezember ';;
esac
echo $begin$month$year
echo "\n"
}
for month in {1..12}
do
git log \
--since=$year-$month-01 \
--until=$year-$month-31 \
--author='mikezter' \
--no-merges \
--date-order \
--reverse \
--abbrev-commit \
--date=local \
--date=short \
--pretty='format:%ad %s' \
--all > gitlog-$year-$month
echo `header $month` | cat - gitlog-$year-$month > /tmp/out && mv /tmp/out gitlog-$year-$month.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment