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

# changes.patch()

> Update a change's metadata, files, or conflict resolutions.

Patch a change. You can update metadata, apply file operations, use a base commit guard, or apply conflict resolutions.

**Required scope: `write`**

```ts theme={null}
import { Buffer } from 'node:buffer';

const change = await mesa.changes.patch({
  repo: 'app',
  change_id: 'zyxwvutsrqponmlkzyxwvutsrqponmlk',
  message: 'Update README',
  files: [
    {
      path: 'README.md',
      content: Buffer.from('# Updated\n').toString('base64'),
    },
  ],
});
```

Resolve conflicts:

```ts theme={null}
await mesa.changes.patch({
  repo: 'app',
  change_id: 'zyxwvutsrqponmlkzyxwvutsrqponmlk',
  resolutions: [{ path: 'README.md', take: 'target' }],
});
```

## Options

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

<ParamField path="change_id" type="string" required>
  Change ID to patch.
</ParamField>

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

<ParamField path="message" type="string | undefined">
  Replacement change description. Omit to preserve the existing description; pass `""` to clear it.
</ParamField>

<ParamField path="author" type="object | undefined">
  Replacement author identity.
</ParamField>

<ParamField path="committer" type="object | undefined">
  Replacement committer identity.
</ParamField>

<ParamField path="files" type="array | undefined">
  Non-empty file operations to apply. Cannot be combined with `resolutions`.
</ParamField>

<ParamField path="base_commit_oid" type="string | undefined">
  Optional optimistic concurrency guard. The patch fails if the change no longer points at this commit.
</ParamField>

<ParamField path="resolutions" type="array | undefined">
  Conflict resolutions to apply. Cannot be combined with `files`.
</ParamField>

## Response

<ResponseField name="id" type="string">
  Change ID.
</ResponseField>

<ResponseField name="current_commit_oid" type="string">
  Current commit OID for the change.
</ResponseField>

<ResponseField name="is_conflicted" type="boolean">
  Whether the current commit still contains unresolved conflicts.
</ResponseField>

<ResponseField name="message" type="string">
  Current change description. Empty string means the change has no description.
</ResponseField>

<ResponseField name="author" type="CommitIdentity">
  Commit author identity.
</ResponseField>

<ResponseField name="committer" type="CommitIdentity">
  Committer identity.
</ResponseField>

<ResponseField name="parents" type="string[]">
  Parent change IDs for this change.
</ResponseField>

<ResponseField name="created_at" type="string">
  Creation time.
</ResponseField>

<ResponseField name="updated_at" type="string">
  Last update time.
</ResponseField>

### CommitIdentity

<ResponseField name="name" type="string">
  Author or committer display name.
</ResponseField>

<ResponseField name="email" type="string">
  Author or committer email address.
</ResponseField>

<ResponseField name="date" type="string | undefined">
  Timestamp for this identity when provided.
</ResponseField>
