Skip to content

Instantly share code, notes, and snippets.

@smuuf
Created September 28, 2016 07:26
Show Gist options
  • Save smuuf/0d5746c4e734c51fe0de3559d02cb852 to your computer and use it in GitHub Desktop.
Save smuuf/0d5746c4e734c51fe0de3559d02cb852 to your computer and use it in GitHub Desktop.
# Echo number of GIT commits per year.
git log --pretty='format:%cd' --date=format:'%Y' | uniq -c | awk '{print "Year: "$2", commits: "$1}'
@pmaruszczyk
Copy link

@olleharstedt It seems this refers to branch which you have checkouted.

@olleharstedt
Copy link

@lordt Yes. I've added --all to include all branches. Thank you.

@smuuf
Copy link
Author

smuuf commented Mar 28, 2020

Heh, nice to see this is useful to someone else, too. :)

@gshah30
Copy link

gshah30 commented Jun 18, 2023

Adding a sort in between ensures that all the years appear only once in the final result.
git log --pretty='format:%cd' --date=format:'%Y' | sort | uniq -c

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