Skip to content

tld git compare

View Markdown

tld git compare shows what a set of code changes does to your architecture. Point it at two revisions and it renders the difference as a diagram.

Terminal window
tld git compare HEAD~1 HEAD

By default you get the impact diagram: the exact payload the canvas loads, self-contained, so it renders without the repository, its index, or its snapshots. Each placement carries a change overlay with the file’s line counts and structured symbol changes, and the view names what it compared.

To render it as a diagram instead:

Terminal window
tld git compare HEAD~1 HEAD --mermaid
tld git compare HEAD~1 HEAD --markdown

--markdown just adds a code fence for easy copy-paste into your docs.

Any Git revision works: hashes, tags, branches, or ranges.

Terminal window
tld git compare HEAD~1 HEAD
tld git compare main feature-branch
tld git compare abc123 def456
tld git compare HEAD~5 HEAD --mermaid

The repository is optional and defaults to the current checkout. Pass a repository id, local path, or remote URL:

Terminal window
tld git compare github.com/org/repo main feature
tld git compare /path/to/repo HEAD~1 HEAD

Remote repositories are cloned on demand; missing snapshots are indexed on demand.

--depth controls how many dependency hops of unchanged context are included in the diagram:

Terminal window
# Direct changes only — fast and focused
tld git compare HEAD~1 HEAD --depth 0
# Wider context. This can easily explode the diagram if the change touches a widely-used symbol.
tld git compare HEAD~1 HEAD --depth 2
FlagDefaultWhat it does
--mermaidfalseEmit the Mermaid change diagram instead of the scene
--markdownfalseWrap the Mermaid diagram in a Markdown code fence
-v, --verbosefalseReport indexing progress for both revisions on stderr
--depth3Dependency hops of unchanged context to include (0 = direct changes only)
--radius--depthBlast radius to display
--max-nodes400Node budget; the blast radius is narrowed when exceeded (0 disables)
--max-bytes2097152Output byte budget (0 disables)
--max-elements0Skip output when the diagram exceeds this element count (0 disables)
--max-connectors0Skip output when the diagram exceeds this connector count (0 disables)
--report-jsonWrite comparison status, counts, revisions, and index warnings to a JSON file
--prepare-commandRun a Bash command in each uncached revision before indexing
--data-dirOverride the data directory

Indexing progress is quiet by default so scripted runs only emit the payload and budget warnings. Pass --verbose to follow the base and head scans on stderr.

Some repositories need a build or dependency step before indexing. --prepare-command runs once in each uncached revision before indexing, and its contents become part of the snapshot config hash, so changing it invalidates cached snapshots.

Terminal window
tld git compare HEAD~1 HEAD --prepare-command "npm ci --ignore-scripts"

Setup must leave the tracked indexing inputs unchanged. Failure stops the comparison.

--report-json writes a machine-readable report for CI:

Terminal window
tld git compare HEAD~1 HEAD --report-json compare.json

The report includes status (ready, skipped, or empty), element/connector counts, base/head revisions, index warnings, and change stats: files, directories, subsystems, lines added/removed, and symbols added/modified/removed.

--max-elements and --max-connectors are hard limits checked before rendering. Exceeding either suppresses stdout and exits successfully; the snapshots stay in the database. Equality is allowed.

To post these diagrams on pull requests automatically, use the PR diagram bot.