Semantic Splinter

Diff and merge
beyond text.

Format-aware diff, three-way merge, and patch for files that line-based tools handle badly.

Images, archives, structured data, PDFs, databases, and 3-D meshes — parsed into their semantic units and merged unit by unit, then written back as a valid file. One C++ tool, splinter, that runs standalone and as a Git textconv, diff driver, and merge driver.

pre-release · feature-complete for v1 formats · in testing

Get a copy

There are no binary releases yet, so you build from source. Clone the repository and follow BUILDING.md — it's C++20 with CMake and vcpkg.

# over HTTPS
git clone https://github.com/AlphaPixel/SemanticSplinter.git

# or with the GitHub CLI
gh repo clone AlphaPixel/SemanticSplinter

The tool lands at build/<preset>/src/cli/Release/splinter (splinter.exe on Windows). splinter --version prints the version for bug reports.

Why it exists

A one-pixel edit to a PNG changes most of its compressed bytes. Git shows "Binary files differ" and cannot merge two artists' edits to different parts of the same image. Splinter parses each format into its semantic units — pixels, chunks, archive members, XML elements, JSON keys, table rows, PDF objects — diffs and merges those, and writes a valid file back.

What it looks like

splinter old.png new.png                  # changed regions, metrics, metadata
splinter -u old.png new.png               # unified diff over canonical dump lines
splinter --json=report.json a.png b.png   # machine-readable report
splinter -m mine.png base.png theirs.png  # three-way merge, as diff3 -m
splinter -m mine.zip base.zip theirs.zip  # members merged by path, each by its format
splinter -m mine.db  base.db  theirs.db   # SQLite: rows by key, cells merged
splinter --binary a.png b.png > logo.patch  # an applicable semantic patch
splinter -P < logo.patch                  # apply it, as patch
splinter git-setup                        # wire up as Git diff + merge driver

v1 formats

Every format below diffs and merges today. Patch output and per-format limits are tracked in the format documents.

FormatDiffMergePatchDocument
Text✔✔✔text
Unknown binary✔opt-in—binary
ZIP, TAR (gz/zst/xz/bz2)✔✔✔containers
XML✔✔✔xml
JSON, JSONC✔✔✔json
CSV, TSV✔✔—csv
SVG, SVGZ✔✔—svg
PNG✔✔✔png
JPEG✔✔—jpeg
TIFF, GIF, WebP, BMP, TGA, QOI✔✔—raster-misc
SQLite✔✔—sqlite
PDF✔partial—pdf
OBJ/MTL, PLY, STL✔✔—mesh

Documentation