Skip to content

Commit

Permalink
Improve git-mine-by-day
Browse files Browse the repository at this point in the history
  • Loading branch information
indrekj committed Aug 4, 2013
1 parent 04535d6 commit 6d7b3b2
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions git-mine-by-day
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,35 @@
author=`git config --get user.name`

commits() {
git log --author="$author" --no-merges --format="%cd %s" --date=short
git log --author="$author" --no-merges --format="%ad %s" --date=short --date-order
}

main() {
LAST_DATE=""
BODY=""

commits | sort -u -r | while read COMMIT; do
DATE=`echo $COMMIT | cut -d ' ' -f1`
SUBJECT=`echo $COMMIT | cut -d ' ' -f2-`

if [ "$LAST_DATE" != "$DATE" ]; then
LAST_DATE=$DATE
echo
echo
echo [$DATE]
fi

IFS="
"
printf "%s. " "$SUBJECT"
done
commits | sort -gs -t ' ' -k1 |
{
while read COMMIT; do
DATE=`echo $COMMIT | cut -d ' ' -f1`
SUBJECT=`echo $COMMIT | cut -d ' ' -f2-`

if [ "$LAST_DATE" != "$DATE" ]; then
echo $BODY

LAST_DATE=$DATE
BODY=""

echo
echo
echo [$DATE]
fi

BODY="$SUBJECT. $BODY"
done

echo $BODY
}
}

main | less

0 comments on commit 6d7b3b2

Please sign in to comment.