Skip to content

Instantly share code, notes, and snippets.

@redolivedev
Last active February 21, 2017 19:12
Show Gist options
  • Save redolivedev/b97f659c416544623854f525d70b4d93 to your computer and use it in GitHub Desktop.
Save redolivedev/b97f659c416544623854f525d70b4d93 to your computer and use it in GitHub Desktop.
Get your time from all repos in directory for the last month and save it to a file on your desktop
#!/bin/bash
# Instructions
## Save this file to the root of where your projects are stored
## cd to the projects root directory and run chmod +x _timelog.sh
## Change Michael Bonner to your name as it's set in your git config
#
AUTHOR="Michael Bonner"
ONE_MONTH_AGO=`date -j -v-1m`
rm -f ~/Desktop/timelog.txt
echo "Looking for entries for $AUTHOR"
for d in `find . -name .git -type d`; do
cd $d/.. > /dev/null
echo -e "\n${HIGHLIGHT}Checking `pwd`$NORMAL"
git log --author="$AUTHOR" --after=ONE_MONTH_AGO --date=short --pretty=format:"%ai $d : %s" >> ~/Desktop/timelog.txt
echo "\n" >> ~/Desktop/timelog.txt
cd - > /dev/null
done
sort -r -o ~/Desktop/timelog.txt ~/Desktop/timelog.txt
open ~/Desktop/timelog.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment