Skip to content

Commit 1c7affc

Browse files
committed
Include year
1 parent 10e8808 commit 1c7affc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/git/scripts/commits_per_month

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
# * `grep Date`
88
# - Extract the line which begins with `Date` from each log.
99
# * `awk '{}'`
10-
# - From each date line, extract the month (`$3`).
11-
# * `sort -M`
12-
# - Sort by month name.
10+
# - From each date line, extract the month (`$3`) and year (`$6`).
11+
# * `sort -k1n -k2M`
12+
# - Sort the year numerically and sort the second key as a month.
1313
# * `uniq -c`
1414
# - Remove repeated lines and count the repeats to show monthly totals.
15-
git log | grep Date | awk '{print $3}' | sort -M | uniq -c | awk '{print $2 OFS $1}'
15+
# * `awk '{}'`
16+
# - Format the output.
17+
git log | grep Date | awk '{print $6 OFS $3}' | sort -k1n -k2M | uniq -c | awk '{print $3 OFS $2 OFS $1}'

0 commit comments

Comments
 (0)