# 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:

```bash
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:

```bash
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:

```bash
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:

```bash
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`:

```bash
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

- [Quick Start](02-Quick-Start) — run your first review
- [How Reviews Work](09-How-Reviews-Work) — how nitpik assembles context from your diff
- [Configuration](14-Configuration) — all CLI flags
