Skip to content

05 Diff Inputs

github-actions[bot] edited this page May 19, 2026 · 1 revision

Diff Inputs

nitpik needs a diff to review. Choose the input mode that fits your workflow — each accepts code differently and has distinct use cases.


Input Modes

You must specify exactly one input source per review run.

Git Diff (--diff-base)

Diff the current working tree against a branch, tag, or commit:

nitpik review --diff-base main
nitpik review --diff-base origin/develop
nitpik review --diff-base abc1234

This is the most common mode. It runs git diff under the hood and captures all changes between the base ref and your current state. Requires git.

Best for: local development, CI pipelines with branch-based reviews.

File Scan (--scan)

Review a file or directory directly, without git:

nitpik review --scan src/main.rs
nitpik review --scan src/handlers/

Treats the entire content as "new code" — there's no base to diff against, so every line is reviewed. Findings are not filtered to diff hunks.

Best for: reviewing files outside a git repo, auditing specific files, onboarding existing code.

Diff File (--diff-file)

Read a pre-computed unified diff from a file:

nitpik review --diff-file changes.patch

Useful when the diff is generated by another tool or saved from a previous step.

Best for: CI pipelines that generate patch files, reviewing diffs from non-git VCS.

Stdin (--diff-stdin)

Pipe a unified diff from another command:

git diff main | nitpik review --diff-stdin
git diff --cached | nitpik review --diff-stdin

Best for: composing nitpik with other tools, reviewing staged changes, custom diff generation.

How Large Diffs Are Handled

When a single file's diff is very large, nitpik automatically splits it into smaller chunks. Each chunk is reviewed as a separate LLM call, and the findings are merged afterward. This keeps each prompt focused and within token limits.

You don't need to configure this — it happens automatically.

Working Directory

By default, nitpik operates in the current directory. Override with --path:

nitpik review --diff-base main --path /path/to/repo

This sets the repository root for git operations, file reads, and project doc detection.

Related Pages

Clone this wiki locally