Skip to content

Instantly share code, notes, and snippets.

@khanlou
Created February 5, 2021 19:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khanlou/abb76cd12732d96b787cc058afc17f44 to your computer and use it in GitHub Desktop.
Save khanlou/abb76cd12732d96b787cc058afc17f44 to your computer and use it in GitHub Desktop.

This is a quick way to approximate how many person-hours have put into a git repo.

git log --pretty=format:"%ae %ad" --date=format:'%Y-%m-%d %H' | uniq | wc -l

The --pretty=format gives you the author email and commit date, and the date is formatted to just include the year, month, day and hour, like so: 2020-12-22 16. You can add a grep before or after the unique to filter out by author. wc -l tells you the number of lines, which are uniqued, meaning if you had two commits in the same hour, those are filtered out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment