---
title: "overlane repo diff-file"
description: "Show one file's full diff between two commits, including a file too large for the diff listing"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.overlane.app/llms.txt
> Use this file to discover all available pages before exploring further.

# overlane repo diff-file

{/* Generated by apps/docs/scripts/generate.mjs (CLI pages from the command registry in packages/cli). Do not edit; run `pnpm --filter @overlane/docs gen`. */}

Prints the whole change to one file, with every hunk, between BASE and HEAD (each a branch name or a commit SHA). Use it for a file that `overlane repo diff` or `overlane repo pr diff` listed with counts and no hunks because it was large. Leave out --base for a file that did not exist before, and pass --previous with the old path for a file that was renamed. Unified text by default, --json for the structured diff.

## Usage

```sh
overlane repo diff-file repo path --head REF [--base REF] [--previous PATH]
```

## Arguments

| Argument | Required | Description |
| --- | --- | --- |
| `repo` | yes | The repository name or ID |
| `path` | yes | The file's path in the repository |

## Flags

| Flag | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `--head` | string | yes |  | The newer side: a branch name or a commit SHA |
| `--base` | string | no |  | The older side: a branch name or a commit SHA (leave out for a new file) |
| `--previous` | string | no |  | The file's old path when it was renamed |

## Examples

```sh
overlane repo diff-file app src/big.ts --base main --head feature/add
overlane repo diff-file app src/new.ts --head 4f2a9c1 --json
```

## Behavior

- Effect: `read` (changes nothing).
- Needs credentials: yes. Uses the network: yes.
- Supports `--dry-run`: no. Accepts `--force`: no.
- Machine-readable description: `overlane schema repo diff-file`.

## Result

With `--json` (the default when stdout is not a terminal) the command prints this JSON Schema's shape on stdout.

```json
{
  "type": "object",
  "properties": {
    "tenantId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
      "description": "tenant identifier"
    },
    "repoId": {
      "type": "string",
      "pattern": "^repo_[A-Za-z0-9]{6,40}$"
    },
    "file": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000
        },
        "previousPath": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "added",
            "modified",
            "deleted",
            "renamed",
            "binary"
          ]
        },
        "additions": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "deletions": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "truncated": {
          "type": "boolean"
        },
        "hunks": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "oldStart": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "oldLines": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "newStart": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "newLines": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "context",
                        "add",
                        "delete"
                      ]
                    },
                    "oldLine": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "newLine": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "text": {
                      "type": "string"
                    },
                    "noNewline": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "type",
                    "oldLine",
                    "newLine",
                    "text"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "oldStart",
              "oldLines",
              "newStart",
              "newLines",
              "lines"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "path",
        "previousPath",
        "status",
        "additions",
        "deletions",
        "truncated",
        "hunks"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "tenantId",
    "repoId",
    "file"
  ],
  "additionalProperties": false
}
```

See [exit codes](/cli/#exit-codes) for the status the process returns.

Source: https://docs.overlane.app/cli/repo-diff-file/index.mdx
