e1praq
Last Updated: February 25, 2016
·
3.336K
· davidstump
8189bae2149dcd07fb2738329aff6e72

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

Say Thanks
Respond

3 Responses
Add your response

3792
Afe6a9de6c4bcdc99f6b5e3990a58b38

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 ·
4076
Eadde9d1ed7a958dd34d4f895bcd4a8c

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 ·
5239
Bc5e9f1dbab8c512e52a97c00389f051

@kablamo Try to use gitstats

over 1 year ago ·
Filed Under