Back to problems
COMP2041
22T2 Q7 — Git commit summary
Run in a directory. If it is not a git repository print Not a git repository; if it is a repo with no commits print No commits. Otherwise print:
Last commit: <YYYY-MM-DD>— the most recent commit's author date- then one line
<count> <author>per author, sorted by commit count descending, ties broken by author name in reverse alphabetical order.
Use git commands; do not parse .git/ directly.
POSIX shell only (#!/bin/dash); use git commands — do not parse .git/ directly. From COMP2041/9044 22T2 Final.
Samples
stdin
expected
Last commit: 2026-01-05 2 Alice 1 Bob
shell
14