Skip to content

Commit 11a6fa9

Browse files
committed
Fix result order
1 parent da29d34 commit 11a6fa9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/git/scripts/commits_per_day

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
# - Extract the line which begins with `Date` from each log.
1111
# * `awk '{}'
1212
# - From each date line, extract the month (`$3`), day (`$4`), and year (`$6`).
13+
# * `sort -k1n -k2M -k3n`
14+
# - Sort the year numerically, sort the second key as a month, and sort the day numerically.
1315
# * `uniq -c`
1416
# - Given that same day commits are on consecutive lines, we can remove repeated lines and count the repeats to show daily totals.
1517
# * `awk '{}'`
1618
# - Format the output.
17-
git log --reverse | grep '^Date' | awk '{print $6 OFS $3 OFS $4}' | uniq -c | awk '{print $3 OFS $4 OFS $2 OFS $1}'
19+
git log --reverse | grep '^Date' | awk '{print $6 OFS $3 OFS $4}' | sort -k1n -k2M -k3n | uniq -c | awk '{print $3 OFS $4 OFS $2 OFS $1}'

0 commit comments

Comments
 (0)