Daily Git Log For Your Timesheet

This is probably the most satisfying command-line lifehack of the year for me:

git log --author=Nate --since=1.day.ago --all-match --format='%s' | tail -r | paste -s -d : - | sed -e 's/:/; /g' | pbcopy

This takes all your commit messages for the last day, concatenates them with a semicolon, and shoves them into your clipboard to paste into Harvest (or On The Job if I’m working freelance).


  • git log options seem pretty obvious except --format='%s' which outputs just the commit message on each line
  • tail -r reverses order of lines
  • paste -s -d : - concatenates & separates each line with a colon
  • sed -e 's/:/; /g' replaces the colon with a semicolon and a space (couldn’t figure out a way to do this in one command)
  • pbcopy shoves the result into your clipboard on OS X

I’m guessing there’s a slightly prettier way to do this, but there’s a reason I keep trying to get everyone to start calling me Hacksaw because I’ve always really wanted a nickname and then I could get a tattoo.

You can also do a a custom span of time e.g. --since=3.days.ago --until=1.day.ago if you want more than just the last day of commits.

UPDATE: If you are in the thick of push battles with your coworker on a project and want to avoid the “Merge branch” lines from git, you can just add sed '/Merge branch/d' to the mix:

git log --author=Nate --since=1.day.ago --all-match --format='%s' | sed '/Merge branch/d' | tail -r | paste -s -d : - | sed -e 's/:/; /g' | pbcopy