Integrations / Command line
Command line
Print the grouped history of a branch, flow metrics, change audit reports and changeset blame in the terminal with mergecat-log.
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
| Flag | Value | Default | Effect |
|---|---|---|---|
branch | Branch, tag or commit | Default branch | The history to group. Default: the remote default branch (origin/HEAD), then origin/main, origin/master, main, master, then the current branch |
--repo | Path | Current directory | The repository (any folder inside it) |
--base | Tag, branch or commit | none | Only what entered after this ref, e.g. the previous release |
--since | YYYY-MM-DD | none | Integration date from (inclusive) |
--until | YYYY-MM-DD | none | Integration date to (inclusive) |
--grep | Text | none | Subject, SHA prefix, branch name, pull request number or title, also inside groups |
--author | Text | none | Author or integrator name or e-mail, also inside groups |
--limit | Number | 50 | Maximum top-level entries of the history |
--all | No limit | ||
--format | text, json, markdown, csv, html | text; html with --audit | Output format; see Output formats |
--show-forward-integration | hidden | Show the “merge main into feature” commits inside groups | |
--metrics | Print flow metrics instead of the history | ||
--audit | Print the change audit report | ||
--env | Name=ref or Name=tag:pattern | none | An environment for the audit report; repeatable |
--blame | File path | Changeset blame of a file, relative to the repository root | |
--rev | Revision | working tree | The revision --blame annotates |
-h, --help | Print 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-likeormainline-invertedappear 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
| Format | History | Metrics | Audit |
|---|---|---|---|
text | Tree as shown above (default) | Summary (default) | |
json | Summary, entries and the commits of each group | Full metrics report | Full report with fingerprint |
markdown | Changelog-style document, one section per entry | Summary and changes table | |
csv | One row per commit, with the columns of its changeset | One row per change | |
html | Readable document | Printable 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
| Metric | Meaning |
|---|---|
| entries, integrations, direct | Changesets of the period: merges, squash merges, pull request groups and direct commits |
| commits, authors, reverts, lines | Commits in all entries, distinct authors, reverts, lines added and removed |
| via pull request | Share of the entries that went through a pull request |
| lead time | From the first commit of a change to its integration: median and 90th percentile |
| change size | Lines changed per entry: median and 90th percentile |
| risk | Entries 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.