Git diff

Boards are text, so git already diffs them — but a line-level diff of a .kicad_pcb tells you nothing. typecad-pcb diff renders two boards against each other: layer images to eyeball, plus netlist and BOM deltas, in one HTML report.

command

diff

Three ways to call it: two files, a git revision against the working tree, or two git revisions. Git forms extract the board from history with git show — no stash, no checkout.

Example first

file vs file
typecad-pcb diff original.kicad_pcb modified.kicad_pcb
revision vs working tree
typecad-pcb diff HEAD ./build/typecad_concepts.kicad_pcb
revision vs revision
typecad-pcb diff v1.0 v1.1 -- ./build/typecad_concepts.kicad_pcb
FlagMeaning
--fullInclude all layers — the standard set otherwise (User layers off)
--theme=<name>SVG plot theme for the renders (default: the typeCAD house theme)
--output=<path>HTML destination — default gitdiff-results.html next to the modified file

What's in the report

SectionContent
Layer rendersEvery copper layer side by side — the HTML viewer offers side-by-side, overlay, onion-skin, diff-only, and swipe views
Netlist diffNets added, removed, and re-pinned between the two boards
BOM diffParts added, removed, changed, with values and footprints
Textual diffThe raw board file differences
function

generateDiffs

The same comparison from code — build it into CI, a pre-merge check, or your own tooling. Requires KiCAD initialized first.

Example first

diff.ts
import { KiCAD } from '@typecad/pcb';
import { generateDiffs } from '@typecad/pcb/diff';

new KiCAD();

let html = await generateDiffs({
  originalFile: 'original.kicad_pcb',
  modifiedFile: 'modified.kicad_pcb',
  fullMode: false,
  theme: 'KiCAD Default',
});

Returns the written HTML file's path. fullMode and theme mirror the CLI flags.

© 2026 typeCAD — code-defined electronics github