PIERRE COMPUTER COMPANY
CODE STORAGE
2026
<< back
Date:NOV.21.2025Feature:CreateCommit EndpointAuthor:Ian Ownbey
------

We’ve added new createCommit and createCommitFromDiff endpoints that let you programmatically construct commits through our REST API — without requiring a Git push or local repository state.

These endpoints are optimized for automation, AI-generated changes, and incremental edits, where spinning up a full Git workflow would be slow or impractical.

const result = await repo
  .createCommit({
    targetBranch: 'main',
    commitMessage: 'Update dashboard docs',
    expectedHeadSha: currentHeadSha, // optional safety check
    author: { name: 'Docs Bot', email: 'docs@example.com' },
  })
  .addFileFromString('docs/changelog.md', '# v2.1.0\n- refresh docs\n')
  .addFile('public/logo.svg', await fs.readFile('assets/logo.svg'))
  .deletePath('docs/legacy.txt')
  .send();

With createCommit, you can add, update, delete, or stream file contents as part of a single atomic commit. The API supports incremental mutation of the commit payload before it’s finalized and written.

The optional expectedHeadSha acts as a lightweight concurrency guard, preventing commits from landing if the branch has moved unexpectedly.

For workflows that already produce diffs — such as code generators, formatters, or external tooling — you can alternatively submit a full patch using createCommitFromDiff.

const result = await repo.createCommitFromDiff({
  targetBranch: 'main',
  expectedHeadSha: currentHeadSha,
  commitMessage: 'Apply generated SDK patch',
  author: { name: 'Diff Bot', email: 'diff@example.com' },
  committer: { name: 'Diff Bot', email: 'diff@example.com' },
  diff,
});

See the SDK →

+ UP NEXT +