Counting developer activity from git
GitHub Auditor’s activity report counts each developer’s commits, lines and reviews across an account so that the totals mean what they say.
Counting commits sounds like a job for one git log command. GitHub Auditor’s activity report does more than that: it says what each developer did over a date range, across every repository in an account, with commits, lines added and removed, pull requests, reviews and tags. Most of its code is there to keep those numbers honest, with no work counted twice, no lines counted that nobody wrote, and no missing data passed off as a quiet week.
Where the numbers come from
The report reads commits, line counts and tags from local clones. It only asks the GitHub API for what git doesn’t know: pull requests, issues, reviews and comments. Git is fast, costs no API requests, and the clones are still there after access to an account has ended, so the report keeps working for it.
Every clone is fetched before the scan to include work pushed since the last checkout, and the report’s header says when the data was fetched. If the API login fails, the report carries on from git alone and says so at the top. The pull request and review columns then show “n/a”, because those numbers are unknown, not zero.
Whole days in one timezone
A report for 10 to 16 October should run from midnight on the 10th to the last second of the 16th. Git’s --since=2026-10-10 doesn’t mean that. Given a bare date, git takes the current time of day: a report run at 18:13 would start at 18:13 on the 10th. The tool gives git full timestamps in the configured timezone, Europe/London by default:
def git_args(self) -> list[str]:
last = self.end - timedelta(seconds=1)
return [
f"--since={self.start.isoformat(timespec='seconds')}",
f"--until={last.isoformat(timespec='seconds')}",
]
The API’s timestamps are in UTC, and they’re converted to local dates before they’re compared. In British Summer Time, anything that happens between midnight and 1am local time has a UTC date of the day before.
I date commits by their committer date, not their author date. Git picks the commits in a range by committer date, and using the same date in the daily table means the days always add up to the total. The cost is that rebased work counts on the day it was rebased.
Lines nobody wrote
A developer who updates package-lock.json can add thousands of lines without writing one. Line counts leave out lock files at any depth, vendored and built folders, minified files, recorded test data such as mocks and fixtures, data files such as CSV exports, and binary files.
Binary files have to be listed by extension. Git treats a file as binary if it finds a NUL byte in its first 8KB. A JPEG without one is diffed as text, and every row of bytes counts as a line.
The exclusions are git pathspecs, but filtering the log with them has a side effect. A commit that only touched excluded files disappears from the log, and adding an exclusion would change the commit count as well as the line count. Instead the tool runs the log twice: once without the pathspecs, for the list of commits and their raw line counts, and once with them, for the lines that count. Then it joins the two by commit hash:
for c in commits:
raw_add, raw_del = c["additions"], c["deletions"]
k = counted.get(c["sha"])
c["additions"] = k["additions"] if k else 0
c["deletions"] = k["deletions"] if k else 0
c["excluded_additions"] = max(0, raw_add - c["additions"])
c["excluded_deletions"] = max(0, raw_del - c["deletions"])
A lock file update still counts as a commit, with no lines. The difference between the two passes goes into a table of what was left out for each developer, where a big import still shows up.
One person, several names
The same person often commits as “Bob Example” on one machine and “bob-example” on another, with different email addresses. Left alone, they’d get two rows in the leaderboard.
The API helps first. GitHub’s list of commits links many email addresses to a login, and GitHub’s noreply addresses contain the login. After that, entries are joined when they share an identity: a name or login reduced to lowercase letters and digits, or the part of the email address before the @. A small union-find groups them, so the links are transitive, and each group folds into the entry with the most commits:
for key, dev in dev_map.items():
for raw in (dev.name, dev.github_login):
ident = _normalise_name(raw or "")
link(ident if len(ident) >= 4 else "", key)
link(_email_identity(dev.email), key)
Short identities are too generic to merge on. Names and logins under four characters are skipped, and so are email local parts under eight characters, shared mailboxes such as admin or developer, and noreply addresses. Anything the automatic matching can’t settle goes in a developer_aliases list in the config.
Bots are kept apart. Accounts such as renovate[bot] get their own table, outside the leaderboard but inside the totals, and the two still add up.
The same work twice
By default the log covers every branch. With --branches, commits on the default branch are counted from there, and work on other branches is shown in its own section. A rebased or cherry-picked copy of a commit has a new hash, and matching by hash would count it twice. The tool matches by git patch-id --stable instead, a hash of the diff that ignores line numbers and whitespace, which a commit and its rebased copy share. A branch commit whose patch is already on the default branch is dropped. When the same patch is on several branches, it’s credited to the earliest copy, the original, not to anyone’s re-application of it. Branches whose pull requests are all closed are skipped, because that work has either landed or been abandoned.
When the API runs out
A GitHub token gets 5,000 requests an hour. Before a scan, the tool prints how many are left. If they run out part way through, the client waits for the reset. I’d take an hour’s pause over a report full of zeros. Any call that still fails is listed in a data quality block at the top of the report, with the repository and the call, where nobody can miss the gap.
Run a report
auditer checkout --account my-org
auditer activity --account my-org --since 2026-10-05 --until 2026-10-18
The report is Markdown, written to reports/my-org/ with the date range in its file name. The project’s own docs cover the other options, including the aliases list and the exclusions.
More on GitHub Auditor
Featured projects
-
Apple News API
Publish articles and live coverage to Apple News from PHP, with the whole Apple News Format built from objects.
-
PrintMD
Markdown in, and a designed PDF, Word or PowerPoint file out. Its PDF service runs on your own computer.
-
Where Should I Live
Which city would leave you best off? Cities ranked by take-home pay, living costs, visas and the way you live.
-
Solar Calendar
Thirteen months of exactly four weeks, with the year starting on the first Monday on or after the spring equinox.
-
TurboPush
Resumable uploads of very large files from the browser, put back together by one PHP class on the server.
More writing
-
Many sessions at once, and what still needs me
Fifteen coding-agent sessions across two Linux boxes, one session that watches the rest, what it may answer for me, what it never may, and why a yes it passes on gets checked against what I typed.
-
61 public repos of agent tooling, none installed, six ideas kept
One author, 61 public repositories of coding-agent tooling: what I checked before any of it got near my Linux boxes, why none of it was installed, and the six ideas I built my own way.
-
Rules a coding agent cannot talk its way round
The hook that reads every command a coding agent wants to run on my Linux boxes: what it refuses, the 27 proofs that its tests fail when a rule is taken out, and the four lines every report opens with.
-
Dozens of repos, one person
46 repositories and two Linux boxes with nobody else on them: the diary, the decision table, the rebuild guide and the job that keeps both sets of clones in step.