Skip to content

Instantly share code, notes, and snippets.

@michaelbonner
Last active February 15, 2023 19:08
Show Gist options
  • Save michaelbonner/7dad3c2fcd6ab9b2c99cd08749f0d8b1 to your computer and use it in GitHub Desktop.
Save michaelbonner/7dad3c2fcd6ab9b2c99cd08749f0d8b1 to your computer and use it in GitHub 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"
TWO_MONTHS_AGO=`date -j -v-2m`
echo "" > ~/Dropbox/Bootpack/timelog.txt
echo "Looking for entries for $AUTHOR"
for d in `find ~/Development -name .git -maxdepth 3 -type d -not -path "/Users/michaelbonner/Development/non-billable-projects/*"`; do
cd $d/.. > /dev/null
echo -e "\n${HIGHLIGHT}Checking `pwd`$NORMAL"
git log --branches --remotes --author="$AUTHOR" --after=TWO_MONTHS_AGO --date=short --pretty=format:"%ai $d : %s" >> ~/Dropbox/Bootpack/timelog.txt
cd - > /dev/null
echo "\n" >> ~/Dropbox/Bootpack/timelog.txt
done
sed -i.bu 's/-0700/|/' ~/Dropbox/Bootpack/timelog.txt && rm ~/Dropbox/Bootpack/timelog.txt.bu
sed -i.bu 's/+0000/|/' ~/Dropbox/Bootpack/timelog.txt && rm ~/Dropbox/Bootpack/timelog.txt.bu
sed -i.bu 's/\/Users\/michaelbonner\/Development\///' ~/Dropbox/Bootpack/timelog.txt && rm ~/Dropbox/Bootpack/timelog.txt.bu
sed -i.bu 's/\/\.git//' ~/Dropbox/Bootpack/timelog.txt && rm ~/Dropbox/Bootpack/timelog.txt.bu
sed -i.bu 's/\\n//' ~/Dropbox/Bootpack/timelog.txt && rm ~/Dropbox/Bootpack/timelog.txt.bu
sort -r -o ~/Dropbox/Bootpack/timelog.txt ~/Dropbox/Bootpack/timelog.txt
# open ~/Dropbox/Bootpack/timelog.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment