Skip to content

Three pull requests, done over

I took one oversized pull request from each of three repos, measured what was really in it, and rebuilt it as a stack of smaller ones. Then I wrote down the naming and changelog rules that would have prevented it.

Joshua Jordan
4 min read
  • Git
  • Code review
  • AI
In This Article

Why look again

Companion to Lean in hard, not blindly

A 13,000-file pull request looks like negligence. Part of it is. But most of those files were built by a script, and counting them as code hides the real problem, which is smaller and easier to fix.

Your choice here drives the next two sections.

1. How big was it really?

GitHub counts every changed line the same. A regenerated JSON snapshot and a rewritten focus handler both count as one line each. Switch the two filters on and watch the number.

registry #17, 13,326 files
642,223lines, as the pull request page shows it
642,223lines with no filter
Written by hand or by an agentBuilt by a script, or data
  • Built registry JSON343,295
  • Docs site source150,885
  • Components and styles36,788
  • Icon data36,624
  • Tests32,838
  • Demos26,070
  • Other source11,866
  • Docs content3,857

Hatched rows were produced by a build step or are data. Nobody was meant to read them line by line.

Three small settings make this visible on every pull request from now on.

.gitattributesCopy
apps/api/public/**        linguist-generated=true**/registry.json          linguist-generated=trueFILE_TREE.md              linguist-generated=truebun.lock                  linguist-generated=true
  • Mark generated paths. GitHub collapses files marked linguist-generated in the diff view, so the reviewer sees source first.
  • Regenerate once, last. The registry branch regenerated its snapshot 16 times in 65 commits. One final chore(registry): regenerate commit keeps every earlier commit readable.
  • Let CI prove it. A check that rebuilds the output and fails on any difference means nobody has to read generated files at all.

2. The same work as a stack

Here is each pull request again, cut along the lines its own commits already drew. Click a row to see the branch, the title and what it would have carried.

registry #17 as 8 pull requests3 of 8 still need another cut

refactor(icons): move icons to @/icons/core

One import path for icons, before anything else touches them. Almost all of it is the icon data moving.

Branch
refactor/icon-core-paths
Size
11,945 lines to read, plus 75,706 generated
From
2 of the original commits
Needs
Nothing

65 commits. Sizes are measured per commit group. Sixteen commits regenerated output and one built the preview. Together they are about 338,000 lines and belong to no row.

Three things came out of doing this honestly.

  • The commits already knew.All three branches had clean, scoped commit messages. The split was sitting in the history. I merged each as one anyway.
  • A split is not enough.Several rows are still tens of thousands of lines. Cutting by topic after the fact can't fix work that was never done in small steps.
  • The changelog saw one topic.The release note for kliffit #35 is one clean sentence about humanized reports. A restyle of every shared control and two filter fixes shipped with it, unrecorded.

3. One change, from branch to changelog

Every change passes through the same six places, and each one has a name or a message to get right. Step through one real change from the registry stack.

feat(ui): native overlays
feat/native-overlays
  • Pass: The type comes first, so a list of branches sorts by kind of work.
  • Pass: 20 characters. The limit is 30, because the branch name becomes the preview hostname.
  • Pass: One topic. If the name needs the word and, it's two branches.

Format: type/topic

The chain matters more than any one link. With squash merging, the pull request title becomes the commit on main, and the body becomes its message. The release note is collected into the changelog. So a vague title is a vague history, and a bloated body is a bloated git log.

4. Try a name

These are the registry's real limits. A branch is at most 30 characters because it becomes part of a preview hostname. A title is at most 72. Type a subject and see what fails.

Name builder
Branch
refactor/native-overlays-css
28 / 30
Commit and PR title
refactor(registry): native overlays, CSS scrollbars, page-layout shell
70 / 72
  • Pass: Has a subject
  • Pass: Fits in 72 characters
  • Problem: A comma or the word and means more than one change. Split it.
  • Pass: Starts lowercase
  • Pass: No closing punctuation
  • Pass: Imperative mood
  • Pass: Says what specifically

5. Changelogs I got right

I started versioning the Kliffit repo in June, and it took a few releases to find a shape. By August each entry names the area, says in one sentence what a user will notice, adds a few bullets, and stops. The pipeline repo got there too.

Three entries from my own repos
---
"@wmc-mono/server": patch
---

Compile Bronze duplicate-detection keys from the contract columns,
avoiding repeated column-name sorting and hashing for wide reports.
Preserve missing/null distinctions, nested-value equality and
unexpected-column fallback. Persisted source signatures and output
schemas are unchanged.
  • Pass: One package and one bump level.
  • Pass: The first sentence says what changed and why it's faster.
  • Pass: The last two sentences say what did not change. That's what a nervous consumer is looking for.

6. The rules, short

The type, scope and length limits are the ones already in the registry's Git config. The 400-line limit and the length check on bodies are proposals I haven't adopted yet.
PlaceRuleChecked by
Branchtype/topic, 30 characters or fewer, one topicPre-push hook
Committype(scope): subject, 72 or fewer, imperative, no full stopCommit hook
PR titleThe same format. It becomes the commit on mainTitle check
PR bodyWhy first. Then consumer impact, deploys and evidenceTemplate and length check
SizeUnder 400 hand-written lines. Generated paths don't countCI, using .gitattributes
Release noteOne file per consumer-visible change, in the same pull requestPath check
ChangelogNever edited by hand. Collected from the notes at releaseRelease workflow
Generated outputOne commit, last, reproducible in CIRebuild-and-compare check

How I measured

  • Sizes come from the merge commit compared with its parent in a local clone. They differ from GitHub's totals by a few percent.
  • "Generated" is a path rule I wrote for each repo. It covers built registry JSON, catalog snapshots, the file tree, lockfiles, icon data, contract data and planning records.
  • "Moved" uses Git's rename detection at 60% similarity.
  • Stack sizes add up the lines in each commit, so a line edited twice on the branch counts twice. They show proportion, and they overstate the final diff.
  • Kliffit is the app repo where I first set up versioning. The rewritten titles, bodies and notes in sections 3 and 4 are my examples. Section 5 quotes real entries, trimmed of commit links.