Skip to content

Commit 0c743ab

Browse files
committed
Add script to print the number of commits per day
1 parent 0fcae2d commit 0c743ab

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tools/git/scripts/commits_per_day

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Prints the number of commits per day.
4+
5+
# * `git log --reverse`
6+
# - Show commit logs in reverse order.
7+
# * `grep Date`
8+
# - Extract the line which begins with `Date` from each log.
9+
# * `awk '{}'
10+
# - From each date line, extract the month (`$3`), day (`$4`), and year (`$6`).
11+
# * `uniq -c`
12+
# - Given that same day commits are on consecutive lines, we can remove repeated lines and count the repeats to show daily totals.
13+
git log --reverse | grep Date | awk '{print " : "$3" "$4" "$6}' | uniq -c

0 commit comments

Comments
 (0)