Skip to main content
Patch a change. You can update metadata, apply file operations, use a base commit guard, or apply conflict resolutions. Required scope: write
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:
await mesa.changes.patch({
  repo: 'app',
  change_id: 'zyxwvutsrqponmlkzyxwvutsrqponmlk',
  resolutions: [{ path: 'README.md', take: 'target' }],
});

Options

repo
string
required
Repository name.
change_id
string
required
Change ID to patch.
org
string | undefined
Organization override.
message
string | undefined
Replacement change description. Omit to preserve the existing description; pass "" to clear it.
author
object | undefined
Replacement author identity.
committer
object | undefined
Replacement committer identity.
files
array | undefined
Non-empty file operations to apply. Cannot be combined with resolutions.
base_commit_oid
string | undefined
Optional optimistic concurrency guard. The patch fails if the change no longer points at this commit.
resolutions
array | undefined
Conflict resolutions to apply. Cannot be combined with files.

Response

id
string
Change ID.
current_commit_oid
string
Current commit OID for the change.
is_conflicted
boolean
Whether the current commit still contains unresolved conflicts.
message
string
Current change description. Empty string means the change has no description.
author
CommitIdentity
Commit author identity.
committer
CommitIdentity
Committer identity.
parents
string[]
Parent change IDs for this change.
created_at
string
Creation time.
updated_at
string
Last update time.

CommitIdentity

name
string
Author or committer display name.
email
string
Author or committer email address.
date
string | undefined
Timestamp for this identity when provided.