Git Repo Hotspot Analyzer
Operator: Abdulla Al Fahad. How tools are built and checked
Most of the bugs and merge conflicts in a codebase come from a small share of its files: the ones that are both large and edited constantly. Version control already knows which those are. This page reads a repository's commit history straight from the .git directory, counts how often each file changed and by how many lines, and ranks files by revisions multiplied by size at the newest commit.
The same history answers two other questions: which files tend to change in the same commits, and which directories have had all their lines written by one or two people. The first points at dependencies nobody wrote down; the second at the places a departure would hurt.
Nothing on the page ranks people. Commit counts reward small commits and say little about review or design, so the authors table is alphabetical and the knowledge view reports how added lines are spread across a directory instead.
Key features
- Hotspot ranking by revisions times lines of code, or times total indentation as a rough complexity proxy, with a scatter plot of the top 150 files
- Temporal coupling: degree, shared revisions and average revisions for each pair of files, with adjustable thresholds that recompute instantly
- Knowledge map by directory depth: contributors with at least 5% of added lines, bus factor and the main contributor's share, with an option to show Author 1, 2, … instead of names
- Monthly commits and lines changed, for everyone or one author, and a code-age table measured from the newest commit read
- Author merging by e-mail address, by full name, by GitHub no-reply address and by alias lines you type, and CSV exports for hotspots, coupling, knowledge and monthly activity (e-mail addresses are never exported)
How the repository is read and what each measure means
The page reads loose objects and packfiles itself. A pack index (version 2) is loaded and searched with its fan-out table; objects are read from the pack through 1 MB slices of the file, so a multi-gigabyte pack is never loaded whole. Delta objects, both offset and reference deltas, are rebuilt from their base, with a limit of 512 links per chain, 64 MB per object and 6 million packed objects in total.
History is walked newest first by commit date, like git log. Every non-merge commit is compared with its first parent by descending only into trees whose ids differ, so a commit that touches three files reads only the trees along those three paths. Merge commits count as commits but contribute no file changes, which is what git log --numstat prints for them. Line counts use the shortest edit script between the old and new text, ignoring binary files (any NUL byte in the first 8,000 bytes), which count as revisions without lines, again as git does.
Coupling follows the definitions of the code-maat tool: commits that touch more than 30 files are ignored (large moves and mass edits say nothing about design), files need at least 5 revisions, pairs at least 5 shared revisions, and the degree is shared revisions divided by the average of the two files' revision counts, as a percentage. All four thresholds can be changed.
Limits: 50,000 commits, with 5,000 as the default; files over 2 MB count only whole-file additions and deletions; sizes and indentation come from blobs up to 1 MB. SHA-256 repositories, the reftable ref format, version 1 pack indexes, linked worktrees and submodule histories are not supported, and opening one produces a message saying so.
How it works
Author lines are joined with a union-find over three keys: the lower-cased e-mail address, the lower-cased full name when it has at least two words, and GitHub no-reply addresses reduced to the account name. Alias lines such as ann@old.example = ann@new.example add links by hand. The most frequent name in a group becomes its label.
Indentation is the sum over non-blank lines of leading whitespace in steps of four columns, with a tab counting as four. Deeply nested code scores high without a language parser, which makes it a cheap proxy for complexity that works on any text file.
When this helps
- A team lead opens Coupling after a release slipped and finds a payment handler and a tax-rules module that were edited in the same commit 14 times, out of 20 revisions each (degree 70.0%). Neither imports the other, so the dependency lives only in people's heads and deserves an explicit interface or a shared test.
- An engineering manager exports the Knowledge CSV and finds three top-level directories with a bus factor of 1. None of the three has had a commit from a second author in the window, so those become pairing targets.
- A developer inheriting a monorepo reads the code-age table and sees most files unchanged for over two years, with a small group changed in the last month. The review starts with that small group.
Opening a file
- Choose the repository folder (or the .git folder inside it) and wait for the branch list.
- Pick a branch, set how many of the newest commits to read, and choose Analyse history.
- Work through Hotspots, Coupling and Knowledge, then export the CSV for the tab you need.
Example
A repository made with git init and four commits: a.txt changed in all four, src/b.js in the first three
commit 1: a.txt (3 lines), src/b.js (1 line)
commit 2 and 3: both files edited, one line replaced in each
commit 4: one line appended to a.txtPer-file counts, identical to git log --numstat --no-renames
a.txt: 4 revisions, 6 lines added, 2 deleted
src/b.js: 3 revisions, 3 lines added, 2 deleted
4 commits, 0 merges, 1 root commitTips for best results
- Raise Ignore commits over N files when a project does large codemods in small commits, and lower it to 10 for a repository that mixes formatting passes with feature work.
- Run the same repository twice with the Lines and Indentation measures. A file that tops both lists is a better refactoring candidate than one that tops only the line count.
- Add alias lines for the one person who committed from a work laptop and a personal one, so the bus factor does not count them twice.
- A shallow clone has no history beyond its boundary, so fetch fully with git fetch --unshallow before judging file ages.
Limits
Renames are not followed. A moved file looks like one deletion and a new file with a fresh history, so a heavily moved file understates its revisions.
Knowledge shares are lines added inside the commits read. If the window starts after a directory was written, the person who wrote it does not appear. Check the period shown above the tabs.
A hotspot shows where change concentrates, not why. Frequent edits to a configuration file or a generated lock file rank high without being a design problem.
Common errors and how to fix them
- No .git directory was found in the chosen folder
- Pick the folder that contains .git, or select the .git directory itself. A folder from a ZIP download of the code has no history to read.
- Object … is missing from the picked files
- The clone is partial or shallow, or the picked folder is missing some of .git/objects. Clone again with the full history, or pick the folder in a way that keeps its subfolders.
- A delta chain is longer than 512 objects
- Git limits delta chains to 50 by default, so a longer one means a damaged or specially crafted pack. Run git gc on a copy and try again.
Reading the knowledge map without ranking people
Bus factor here is the smallest number of people whose added lines make up half of a directory's added lines. A value of 1 means one person wrote most of what is there in the window, which is a fact about the code's history and a prompt to spread knowledge by pairing or review, not a verdict on anyone.
Switch on Show Author 1, 2, … before sharing a screenshot or export. The main-contributor share stays, the name goes, and the conversation can stay on the directory.
Frequently asked questions
How closely do the counts match git log --numstat?
On a 63-commit repository with three authors, a merge, a rename, a binary file and a history packed by git gc --aggressive, revisions, added lines and deleted lines equalled git log --no-renames --numstat for every file. Git's default diff can produce a slightly longer edit script than the shortest possible on a big rewrite, so very large edits can differ by a few lines unless you run git log with --minimal, which this page matches.
Which commits does the cap keep when a repository is larger than the limit?
The newest ones by commit date, in the same order git log uses, so a cap of 5,000 on a 20,000-commit history covers the newest quarter of its commits. The page states the period it covered and that older history exists.
Why is there no leaderboard of authors?
Commit counts reward small commits and say nothing about review, design or support work, and ranking people by them tends to change how they commit. The authors table is alphabetical, and the knowledge view reports spread per directory instead.