Skip to content

About

Compare CSV records by key across Git revisions from GitHub CLI.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

gh csv-compare

Compare a CSV across two Git revisions by a shared key column. See which records were added, removed or modified even if rows or columns were reordered.

Install

Requires Git, the GitHub CLI (gh) and Node.js 24 or newer on your PATH.

gh extension install YHQT-code/gh-csv-compare

Compare Git revisions

Run this from anywhere inside a local Git working tree. Replace BASE and HEAD with two locally available revisions, such as HEAD~1 and HEAD.

gh csv-compare --key order_id --path data/orders.csv BASE HEAD

Use one exact repository-root-relative path, with / as the separator. The path must refer to a regular file in both revisions. Quote paths that contain spaces. Each file must be UTF-8 comma-separated text with a header, at most 2 MiB, 20,000 data rows and 100 columns. Both headers must contain the same column names. Every value in the selected key column must be nonblank and unique within its file. Values are compared as text, so 001 and 1 are different keys.

Read the result

Standard output contains one JSON object with format set to hanziva-csv-compare/v1 and counts holding added, removed, modified and unchanged.

The comparison runs locally without fetching or uploading data. Pass --include-rows to add key_column and rows to the report, including row keys and changed cell values.

gh csv-compare --key order_id --path data/orders.csv HEAD~1 HEAD --include-rows
Exit status Meaning
0 The records match by key.
1 At least one record was added, removed or modified.
2 The invocation or input is invalid, or a Git object is unavailable locally.

License and upstream

MIT licensed. The vendored parser and comparator are from DataKit CSV Compare csv-compare-v0.3.0, commit ca0f1ba304d5c634ad63dec9a158e75c34b4bad4. License · Upstream parser · Upstream comparator

About

Compare CSV records by key across Git revisions from GitHub CLI.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages