Last Updated: February 25, 2016
·
3.898K
· davidstump

Create A Simple Git Timesheet

At the end of each day, I find myself crawling through the git logs to record my activities for the day on our timesheet software. It eventually occurred to me that with a few super simple arguments passed to the git log command, I could have a basic output of my timesheet for that day.

Step 1. Edit Your bash_profile file:

$ subl ~/.bash_profile

Step 2. Add an alias to your profile:

git log --oneline --author="`git config --get user.name`" --since='6am'

Step 3. Save your profile

Step 4. Check your daily timesheet:

david:~/Projects/octopress❮source❯$ timesheet
 2a08dac Adjust navigation mobile styles and hide search field
 816cfef Apply custom style to site
 b96240c Add Murky-Mussels Theme

Nothing complicated at all, but hopefully someone else finds this as helpful as I did. Thanks to @chris_mccord for adding the user.name snippet to this alias.

Cheers!
David

3 Responses
Add your response

Cool, I like this. I didn't know about --since. I've also been trying to learn about my productivity through git. I wrote git-spark to plot my commit history over time on the command line. Now I want to add a --since option.

over 1 year ago ·

Just adding some optional argument:

timesheet () {
  if [ -z "$1" ]; then
    SINCE="8am"
  else
    SINCE=$1
  fi
  git log --oneline --author="`git config --get user.name`" --since=$SINCE
}
over 1 year ago ·

@kablamo Try to use gitstats

over 1 year ago ·