# Five git log commands that show where a codebase actually changes

**TL;DR**
- To see the most changed files in git, run `git log --since="90 days ago" --name-only --format=""` and pipe it through `sort | uniq -c | sort -rn`.
- On Django (35,106 commits), the busiest 90 of the 909 `.py` files under `django/` took 93% of the line changes in the last 90 days.
- Across 195 public repos with 1,000+ GitHub stars in repowise's index (November 2026), the busiest 10% of production files took 68% of 90-day churn in the median repo.

When I open a codebase I have not worked in, the first question is not "what does this do". It is "where does work actually happen". The README tells you what the authors think matters. `git log` tells you what they keep touching.

Here are the five `git log` commands I use for that, each run on a full clone of Django on 10 November 2026 (HEAD `6a8248f`, 35,106 commits). Copy them, swap the paths, and they work on any repo.

## 1. What has been happening lately

```bash
git log --oneline -8
git log --since="90 days ago" --oneline | wc -l
```

```text
6a8248f13f Fixed #18543 -- Corrected ImageField validation documentation.
a1f2b45ce5 Fixed #30306 -- Added input_type to Textarea widget.
d9d05f104e Fixed #36642 -- Fixed capitalization of locale suggestions in makemessages.
f93a84a80c Refs #36642 -- Added makemessages test for en_001 locale.
6675dac0ff Fixed #37482 -- Corrected parse_time() docs about UTC offsets.
8e3dec67c4 Fixed #37330 -- Fixed QuerySet.values() crash with an annotation transform.
368bef0b2e Refs #37330 -- Added further annotations tests for QuerySet.values().
c392a758e6 Fixed #36022 -- Renamed django-admin to django.
243
```

`--oneline` is the readable version of `git log`: abbreviated hash plus subject line. Two things to read from it. The pace (243 commits in 90 days), and the commit style. Django writes "Fixed #NNNNN" for bug fixes, which means you can count fixes per file later with `--grep`. Plenty of repos use `fix:` prefixes for the same purpose.

Add `--graph --all` when you want to see branches and merges too, and `--author=` or `--since=` to narrow it down.

## 2. Which files change most often

```bash
git log --since="90 days ago" --name-only --format="" -- django/ \
  | sort | uniq -c | sort -rn | head -10
```

```text
     10 django/db/models/query.py
      8 django/db/models/sql/query.py
      6 django/db/models/sql/compiler.py
      5 django/template/base.py
      5 django/db/models/fields/json.py
      5 django/contrib/gis/gdal/raster/source.py
      5 django/contrib/admin/options.py
      4 django/utils/deprecation.py
      4 django/http/response.py
      4 django/db/models/fields/related_descriptors.py
```

`--name-only` lists the files each commit touched, and `--format=""` drops the commit header so only file names are left. Count them and you get commits per file. The trailing `-- django/` limits it to the package itself, so docs and tests do not crowd the list.

The ORM (`db/models/query.py`, `sql/query.py`, `sql/compiler.py`) is where Django is being worked on right now. If I were about to contribute to Django, those are the files I would read first, because they are the ones a reviewer will know best.

## 3. How much each file changes

Commit counts treat a one-line typo fix and a 300-line rewrite the same. `--numstat` gives lines added and deleted per file, so you can sum them:

```bash
git log --since="90 days ago" --numstat --format="" -- django/ \
  | awk '{churn[$3] += $1 + $2} END {for (f in churn) print churn[f], f}' \
  | sort -rn | head -10
```

```text
288 django/test/selenium.py
279 django/template/base.py
257 django/contrib/admin/tests.py
216 django/db/models/query.py
176 django/db/models/sql/query.py
175 django/contrib/gis/geos/prototypes/io.py
170 django/utils/version.py
122 django/contrib/gis/gdal/geojson.py
106 django/contrib/admin/options.py
100 django/test/client.py
```

This is churn: lines added plus lines deleted. The list is different from command 2. `django/test/selenium.py` was touched in a single commit, but a large one, and `template/base.py` moves up.

The one number I like to compute from this is how concentrated the churn is. Take every `.py` file under `django/`, rank them by churn, and ask what share the busiest 10% hold:

```bash
N=$(git ls-files 'django/*.py' | wc -l)
git log --since="90 days ago" --numstat --format="" -- 'django/*.py' \
  | awk '$1 != "-" {churn[$3] += $1 + $2} END {for (f in churn) print churn[f]}' \
  | sort -rn \
  | awk -v n=$N '{a[NR]=$1; t+=$1} END {k=int(n*0.1); for(i=1;i<=k && i<=NR;i++) s+=a[i];
      printf "%d of %d files changed; the busiest %d (10%%) hold %.0f%% of %d changed lines\n", NR, n, k, 100*s/t, t}'
```

```text
198 of 909 files changed; the busiest 90 (10%) hold 93% of 4302 changed lines
```

On this clone, ninety files out of 909 took 93% of the line changes in three months. That is normal, not a Django quirk. In a set of 195 popular open-source repos I looked at, [the busiest 10% of production files took 68% of 90-day churn](https://repowise.dev/research/code-health-2026?utm_source=hashnode&utm_medium=community&utm_campaign=devto-05-git-log#finding-1) in the median repo. Change is concentrated almost everywhere, which is why a short list of busy files is such a good place to start reading. (The `$1 != "-"` skips binary files, which `--numstat` reports as `-`.)

## 4. How many people know a file

```bash
git shortlog -sn --no-merges HEAD -- django/db/models/query.py | wc -l
git shortlog -sn --no-merges HEAD -- django/db/models/query.py | head -5 | awk '{print $1}'
git log --format=%H HEAD -- django/db/models/query.py | wc -l
```

```text
180
46
44
41
33
31
646
```

`git shortlog -sn` groups commits by author and counts them. I printed only the counts here, but without the `awk` you get names, which is the point when you want to know who to ask.

Two gotchas. Pass `HEAD` explicitly: without a revision, `git shortlog` reads from standard input when it is not attached to a terminal, so in a script or a pipe it silently prints nothing. And use `--no-merges`, or merge commits inflate the counts of whoever presses the button.

For `query.py`: 646 commits, 180 different authors, and the top five have 46, 44, 41, 33 and 31 commits. No single person dominates. That is unusual, and it is what two decades of history does. On a younger repo you will often see one name with most of the commits on a file. That is the bus factor question, which I looked at across 195 repos in [the previous post](https://dev.to/repowise/bus-factor-1-is-the-default-per-language-ownership-in-195-popular-repos-54kh).

## 5. How one function evolved

`git log -L` follows a range of lines, or a whole function, back through history:

```bash
echo '*.py diff=python' >> .git/info/attributes
git log -L :_fetch_all:django/db/models/query.py --format='%h %ad %s' --date=short -s | grep -v '^$' | head -4
```

```text
f3b7c05936 2016-06-03 Refs #16614 -- Made QuerySet.iterator() use server-side cursors on PostgreSQL.
70679243d1 2012-08-02 Fixed #18702 -- Removed chunked reads from QuerySet iteration
169b1a404c 2012-05-10 Replaced foo.next() by next(foo).
9c52d56f6f 2008-04-27 Merged the queryset-refactor branch into trunk.
```

The `:_fetch_all:` form means "the function called `_fetch_all`". Git finds it with a per-language pattern, and that is what the first line is for. Without the `diff=python` attribute, Git uses its default pattern, which only matches lines that start with a letter, `_` or `$`. A method indented inside a class never matches:

```text
fatal: -L parameter '_fetch_all' starting at line 1: no match
```

Put `*.py diff=python` in `.gitattributes` (shared) or `.git/info/attributes` (just you). Git ships patterns for many languages: `python`, `java`, `golang`, `rust`, `cpp`, `csharp`, `php`, `ruby` and more.

Drop the `-s` to see each diff, which is the fastest way I know to answer "why is this function written like this".

## How do these commands add up to a hotspot list?

Commands 2 and 3 tell you where change concentrates. Command 4 tells you who to ask about those files. Command 5 tells you why a specific piece looks the way it does. Combine churn with complexity and bug fixes and you get a hotspot list, the files most likely to hurt. [This guide on hotspot analysis](https://repowise.dev/blog/guides/git-hotspot-analysis-risky-files?utm_source=hashnode&utm_medium=community&utm_campaign=devto-05-git-log) walks through that ranking step by step.

If you want to skip the shell for Django specifically, [its commit history on repowise](https://repowise.dev/repo/django/django/commits?utm_source=hashnode&utm_medium=community&utm_campaign=devto-05-git-log) shows recent commits scored for risk, with the files each one touched.

## How I got these numbers

Every command above was run on a full clone of `django/django` at `6a8248f` on 10 November 2026, with Git for Windows in a bash shell. The 68% median comes from a set of 195 of the most-starred public repositories indexed on repowise (1,000+ GitHub stars each, 253,688 production source files, November 2026), each measured on production files at its own latest index between May and November 2026.

## FAQ

**How do I see the most changed files in git?**
Run `git log --name-only --format=""`, optionally with `--since` and a path, then count the lines with `sort | uniq -c | sort -rn`. That gives commits per file. For lines changed per file, use `--numstat` and sum the first two columns, as in command 3.

**How do I make git log show only file names?**
`--name-only` prints the files each commit touched, and `--format=""` removes the commit header, so only file names are left. `--name-status` does the same but adds a letter for added, modified or deleted.

**What does git shortlog do?**
`git shortlog` groups commits by author. `-sn` prints a commit count per author sorted from most to least, and `--no-merges` leaves merge commits out. In a script, pass `HEAD` explicitly or it reads from standard input and prints nothing.

