Recently I needed to get the number of days i’d worked on a project. I decided to use my Git commit history to do this. After a bit of tinkering around I came up with this solution.
There’s probably a better way to do this, but this is what I came up with:
- Get the dates of all commits from now till the 1st of May 2012
- Pull out the first 10 characters (Tue May 22, for example)
- Filter by uniqueness
- Count the number of lines returned.
git log --pretty=format:"%ad" --after="1 May 2012" | cut -c -10 | uniq | wc -l
(Note you’ll probably need to change the code to pull out only your commits, on this repository i’m the only committer.)

