Skip to content
mergecat

mergecat-log prints the history of a branch grouped by integration, like the desktop app and VS Code, and exports it as JSON, Markdown, CSV or HTML. It also computes flow metrics, writes the change audit report and annotates a file with the integration of every line. It reads Git only: no hosting service, no credentials, no network.

Run it

The command line is part of the mergecat source code. From the root of a clone (Node.js 20 or newer, Git on the PATH):

npm install
npm run build -w @mergecat/core

Then run it from the repository root, either with the mergecat-log command that npm links for the workspace, or with the built file:

npx mergecat-log --repo ~/src/web-shop
node packages/core/dist/cli.cjs --repo ~/src/web-shop

The examples below use mergecat-log. Set MERGECAT_GIT_PATH if git is not on the PATH.

Usage

mergecat-log [branch] [--repo <path>] [--base <ref>] [--since YYYY-MM-DD] [--until YYYY-MM-DD]
           [--grep <text>] [--author <text>] [--limit <n> | --all] [--format text|json|markdown|csv|html]
           [--show-forward-integration]
mergecat-log --metrics [--format text|json] [--since …] [--until …]
mergecat-log --audit [--base <ref>] [--format html|markdown|csv|json] [--env Name=ref|Name=tag:pattern]…
mergecat-log --blame <file> [--rev <rev>]

Flags

FlagValueDefaultEffect
branchBranch, tag or commitDefault branchThe history to group. Default: the remote default branch (origin/HEAD), then origin/main, origin/master, main, master, then the current branch
--repoPathCurrent directoryThe repository (any folder inside it)
--baseTag, branch or commitnoneOnly what entered after this ref, e.g. the previous release
--sinceYYYY-MM-DDnoneIntegration date from (inclusive)
--untilYYYY-MM-DDnoneIntegration date to (inclusive)
--grepTextnoneSubject, SHA prefix, branch name, pull request number or title, also inside groups
--authorTextnoneAuthor or integrator name or e-mail, also inside groups
--limitNumber50Maximum top-level entries of the history
--allNo limit
--formattext, json, markdown, csv, htmltext; html with --auditOutput format; see Output formats
--show-forward-integrationhiddenShow the “merge main into feature” commits inside groups
--metricsPrint flow metrics instead of the history
--auditPrint the change audit report
--envName=ref or Name=tag:patternnoneAn environment for the audit report; repeatable
--blameFile pathChangeset blame of a file, relative to the repository root
--revRevisionworking treeThe revision --blame annotates
-h, --helpPrint the usage

Filters (--base, --since, --until, --grep, --author) apply to the history, the metrics and the audit report. Dates refer to when a change entered the branch.

The default branch is the remote-tracking branch when there is one, so run git fetch first to include the latest changes, or pass the branch, e.g. mergecat-log main.

Grouped history

mergecat-log --repo ~/src/web-shop
● 2026-11-19 2c08e10 Anna Rossi: Fix typo in README
■ 2026-11-19 611dccf Merge branch 'feature/login' [feature/login · merge-message]
    └ 75d09ca Anna Rossi: Validate password
    └ 4833211 Anna Rossi: Add login form
● 2026-11-19 5860bf5 Anna Rossi: Initial project structure

3 of 3 entries · 1 merges · 2 direct · 5 commits · 14 ms
  • ● a direct commit, ■ an integration with its merged branch and where the name came from (here the merge message), └ the commits it brought in, ↺ a forward-integration merge (with --show-forward-integration).
  • Groups of octopus merges show one ▸ lane per merged branch.
  • Flags such as squash-like or mainline-inverted appear in braces after a row.
  • The last line counts entries, merges, direct commits and commits; warnings (shallow clone, no merges, squash merges) follow with ⚠.

More examples:

# What entered main since v1.2.0
mergecat-log main --base v1.2.0 --all

# Changes of one author in March 2026
mergecat-log --since 2026-03-01 --until 2026-03-31 --author anna@example.com

# Search in subjects, branch names and pull request titles
mergecat-log --grep login

Output formats

FormatHistoryMetricsAudit
textTree as shown above (default)Summary (default)
jsonSummary, entries and the commits of each groupFull metrics reportFull report with fingerprint
markdownChangelog-style document, one section per entrySummary and changes table
csvOne row per commit, with the columns of its changesetOne row per change
htmlReadable documentPrintable report (default)

Write the output to a file with your shell, e.g. mergecat-log --all --format markdown > changesets.md.

Metrics

mergecat-log --metrics --since 2026-01-01

Example output:

Metrics for main (2026-01-08 – 2026-03-27)
  entries 42 · integrations 31 (merges 28, squash 2, PR groups 1) · direct 11
  commits 156 · authors 7 · reverts 1 · +8213 −2944
  via pull request 74%
  lead time median 19 h · p90 6.5 d
  change size median 86 lines · p90 640
  risk: high 4, medium 13, low 25
MetricMeaning
entries, integrations, directChangesets of the period: merges, squash merges, pull request groups and direct commits
commits, authors, reverts, linesCommits in all entries, distinct authors, reverts, lines added and removed
via pull requestShare of the entries that went through a pull request
lead timeFrom the first commit of a change to its integration: median and 90th percentile
change sizeLines changed per entry: median and 90th percentile
riskEntries per risk level; see risk factors

--format json returns the full report: totals, distributions, a series per week or month, and the contributors.

Audit report

# Everything since v1.1.0, as printable HTML
mergecat-log --audit --base v1.1.0 > audit.html

# As JSON, with the environments that run each change
mergecat-log --audit --base v1.1.0 --env 'Production=tag:v*' --env 'Staging=origin/staging' --format json > audit.json
  • --env Name=ref: the environment runs that branch or tag, e.g. Staging=origin/staging.
  • --env Name=tag:pattern: the environment runs the newest tag that matches the glob, e.g. Production=tag:v*.
  • Quote the values: shells expand *.

The command line reads Git only, so approvals are reported as unknown (or “No pull request” for changes without one). For approvals, export the report from the desktop app or VS Code with the hosting service connected. Content, risk factors and fingerprint: Change audit reports.

Changeset blame

mergecat-log --blame src/auth/login.ts
mergecat-log --blame src/auth/login.ts --rev v1.2.0
    1-1     4833211 feature/login                    Add login form
    2-2     75d09ca feature/login                    Validate password

Each range of lines shows the commit, the integration that brought it into the analysed branch (merged branch and pull request number, or the commit for a direct commit) and the commit subject. Lines from commits that did not reach the branch yet say not in <branch>; uncommitted lines say uncommitted. Without --rev, the file in the working tree is annotated.

Exit codes

mergecat-log exits with 0 on success and 1 on an error, which it prints to stderr prefixed with mergecat-log:, for example an unknown option or a folder that is not a Git repository.