Skip to content

Instantly share code, notes, and snippets.

@whylom
Created December 26, 2012 21:29
Show Gist options
  • Save whylom/4383284 to your computer and use it in GitHub Desktop.
Save whylom/4383284 to your computer and use it in GitHub Desktop.
How many commits did we push to master in 2012?

Get the first commit of 2012

$ git log --pretty=format:'%H' --after="2011-12-31" | tail -1
d41d8cd98f00b204e9800998ecf8427e

Count the number of commits since then (inclusive)

$ git rev-list d41d8cd98f00b204e9800998ecf8427e^..HEAD | wc -l 
44555

Or put 1 and 2 together into a gorgeously cryptic one-liner!

$ git rev-list $(git log --pretty=format:'%H' --after="2011-12-31" | tail -1)^..HEAD | wc -l
44555
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment