Dry-run mode (-n / --dry-run)
--dry-run (short: -n) prints a unified diff of the before and after document to stdout. It never writes any file.
Dry-run always exits 0 on success — a non-empty diff is informational, not a gating signal. Use --check if you need to gate on drift.
Basic usage
Input (config.json):
Stdout (unified diff):
The file on disk is unchanged.
YAML dry-run
Input (deploy.yaml):
Stdout:
No-op query
If the query produces no change, the diff body is empty. The command still exits 0:
Combining with -i
-i and -n can both be passed. --dry-run wins: the file is not written and a flag-precedence warning is emitted on stderr:
Stderr:
This is intentional: CI scripts often use -i as a baseline flag and toggle -n to preview what would happen without actually running the edit.
Use in CI — preview before commit
# .github/workflows/ci.yml
- name: Preview config changes (dry-run)
run: nesdit config/values.yaml -n --query '.image.tag = "${{ github.sha }}"'
The step succeeds whether or not there is a diff. Pipe the output to a comment or log for review.
Warning
--dry-run and --check are mutually exclusive:
Related flags
--check— signal drift via exit code without printing a diff.-i/--in-place— write back to disk.--query— the jq-style query to apply.