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

# diffs.get()

> Compare two changes in a repository.

Get structured diff data between two changes.

**Required scope: `read`**

```ts theme={null}
const diff = await mesa.diffs.get({
  repo: 'app',
  base_change_id: 'zyxwvutsrqponmlkzyxwvutsrqponmlk',
  head_change_id: 'yxwvutsrqponmlkzyxwvutsrqponmlkz',
  conflicts: 'include',
});

console.log(diff.stats.additions, diff.stats.deletions);
```

Get only conflict details:

```ts theme={null}
const conflicts = await mesa.diffs.get({
  repo: 'app',
  base_change_id: 'zyxwvutsrqponmlkzyxwvutsrqponmlk',
  head_change_id: 'yxwvutsrqponmlkzyxwvutsrqponmlkz',
  conflicts: 'only',
});
```

## Options

<ParamField path="repo" type="string" required>
  Repository name.
</ParamField>

<ParamField path="base_change_id" type="string" required>
  Base change ID.
</ParamField>

<ParamField path="head_change_id" type="string" required>
  Head change ID.
</ParamField>

<ParamField path="org" type="string | undefined">
  Organization override.
</ParamField>

<ParamField path="conflicts" type="'include' | 'only' | 'exclude' | undefined">
  Conflict detail mode. Defaults to `include`.
</ParamField>

## Response

`entries[]` and `conflicted_entries[]` are mutually exclusive: unresolved conflicted paths appear only in `conflicted_entries[]`.

<ResponseField name="base_change_id" type="string">
  Base change used for comparison.
</ResponseField>

<ResponseField name="head_change_id" type="string">
  Head change used for comparison.
</ResponseField>

<ResponseField name="stats" type="DiffStats">
  Aggregate counts for the response.
</ResponseField>

<ResponseField name="truncated" type="boolean">
  Whether the response hit the server entry limit and is incomplete.
</ResponseField>

<ResponseField name="entries" type="DiffEntry[]">
  Structural changed entries. Unchanged paths are omitted.
</ResponseField>

<ResponseField name="conflicted_entries" type="ConflictedDiffEntry[]">
  Conflict-only details for unresolved paths.
</ResponseField>

### DiffStats

<ResponseField name="entries" type="number">
  Number of structural entries returned in `entries[]`.
</ResponseField>

<ResponseField name="additions" type="number">
  Total added lines across textual diff hunks.
</ResponseField>

<ResponseField name="deletions" type="number">
  Total deleted lines across textual diff hunks.
</ResponseField>

<ResponseField name="changes" type="number">
  Sum of `additions` and `deletions`.
</ResponseField>

<ResponseField name="conflicted_entries" type="number">
  Number of paths returned in `conflicted_entries[]`.
</ResponseField>

<ResponseField name="conflicted_hunks" type="number">
  Total conflict hunk count across `conflicted_entries[]`.
</ResponseField>

### DiffEntry

<ResponseField name="path" type="string">
  Repository-relative path at the head change.
</ResponseField>

<ResponseField name="status" type="'added' | 'modified' | 'deleted' | 'renamed'">
  How the entry changed between the base and head changes.
</ResponseField>

<ResponseField name="old_path" type="string | null">
  Previous repository-relative path for renamed entries. Null for non-renames.
</ResponseField>

<ResponseField name="size_bytes" type="number | undefined">
  Approximate size in bytes of the changed entry content, not the textual diff.
</ResponseField>

<ResponseField name="is_conflicted" type="boolean">
  Always false for entries returned in `entries[]`. Conflicted paths are returned in `conflicted_entries[]`.
</ResponseField>

<ResponseField name="omitted_reason" type="'binary' | 'too_large' | 'file_limit' | null">
  Why textual hunk data is unavailable. Null when `hunks` is present.
</ResponseField>

<ResponseField name="hunks" type="DiffHunk[] | null">
  Structured textual diff hunks. Null when `omitted_reason` is set.
</ResponseField>

<ResponseField name="conflict_hunks" type="DiffConflictHunk[] | null">
  Structured conflict hunks for the entry, or null when there are none. Structural entries in `entries[]` normally return null.
</ResponseField>

### DiffHunk

<ResponseField name="old_start" type="number">
  Starting line number in the base side.
</ResponseField>

<ResponseField name="old_lines" type="number">
  Number of base-side lines covered by the hunk.
</ResponseField>

<ResponseField name="new_start" type="number">
  Starting line number in the head side.
</ResponseField>

<ResponseField name="new_lines" type="number">
  Number of head-side lines covered by the hunk.
</ResponseField>

<ResponseField name="lines" type="DiffLine[]">
  Lines in this textual diff hunk.
</ResponseField>

### DiffLine

<ResponseField name="kind" type="'context' | 'added' | 'deleted' | 'annotation'">
  Line classification inside a textual diff hunk.
</ResponseField>

<ResponseField name="text" type="string">
  Line text.
</ResponseField>

### ConflictedDiffEntry

<ResponseField name="path" type="string">
  Repository-relative path for the unresolved conflict.
</ResponseField>

<ResponseField name="hunks" type="DiffConflictHunk[]">
  Per-hunk conflict detail. Empty when `omitted_reason` is set or the conflict is non-textual.
</ResponseField>

<ResponseField name="size_bytes" type="number | undefined">
  Approximate size in bytes of the largest side of the conflict.
</ResponseField>

<ResponseField name="omitted_reason" type="'binary' | 'too_large' | null | undefined">
  Why hunk data is unavailable. When set, fetch file bytes with `mesa.content.get()` against the target or source change to compose a whole-file resolution.
</ResponseField>

### DiffConflictHunk

<ResponseField name="hunk_id" type="string">
  Stable identifier for the conflict hunk.
</ResponseField>

<ResponseField name="old_start" type="number">
  Starting line number in the base side.
</ResponseField>

<ResponseField name="old_lines" type="number">
  Number of base-side lines covered by the hunk.
</ResponseField>

<ResponseField name="new_start" type="number">
  Starting line number in the head side.
</ResponseField>

<ResponseField name="new_lines" type="number">
  Number of head-side lines covered by the hunk.
</ResponseField>

<ResponseField name="target" type="ChangeConflictHunkSide | null">
  Target side of the conflicted hunk.
</ResponseField>

<ResponseField name="base" type="ChangeConflictHunkSide | null">
  Base side of the conflicted hunk.
</ResponseField>

<ResponseField name="source" type="ChangeConflictHunkSide | null">
  Source side of the conflicted hunk.
</ResponseField>

### ChangeConflictHunkSide

<ResponseField name="content" type="string">
  Base64-encoded raw bytes for this side of the conflicted hunk.
</ResponseField>
