We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 10e8808 commit 1c7affcCopy full SHA for 1c7affc
tools/git/scripts/commits_per_month
@@ -7,9 +7,11 @@
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`).
11
-# * `sort -M`
12
-# - Sort by month name.
+# - From each date line, extract the month (`$3`) and year (`$6`).
+# * `sort -k1n -k2M`
+# - Sort the year numerically and sort the second key as a month.
13
# * `uniq -c`
14
# - 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}'
+# * `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