Skip to content

Git

Every project is backed by a native git store. Commits snapshot the working tree of a branch; all ids are commit SHAs. Committing also syncs to a connected GitHub repository when one is linked.

GET /api/v1/projects/{id}/git/log

Query: branch (default main), limit (default 50, max 200). Returns { commits } — each { oid, message, author_id, committed_at, parent_oids }.

await client.git.log(projectId, { branch: 'main', limit: 20 })
POST /api/v1/projects/{id}/git/commit

Commits all current project files (there is no staging index). Body: optional message, optional branch. Returns { commit: { oid, branch } }.

const { oid } = await client.git.commit(projectId, { message: 'Before refactor' })
GET /api/v1/projects/{id}/git/commits/{oid}

Returns the commit plus the materialized files at that revision: { commit: { …, files } }.

await client.git.show(projectId, oid)
POST /api/v1/projects/{id}/git/restore

Body: oid (required), optional branch. Restores the working tree to that commit as a new commit on the branch. Returns { commit: { oid, branch } }.

await client.git.restore(projectId, oid)
POST /api/v1/projects/{id}/git/merge

Body: source (required), optional target (default main). Returns { merge: { oid, fastForward } }.

await client.git.merge(projectId, { source: 'feature/nav', target: 'main' })
GET /api/v1/projects/{id}/git/branches list → { branches }
POST /api/v1/projects/{id}/git/branches create → { branch }
DELETE /api/v1/projects/{id}/git/branches/{name} delete → { deleted }

Create takes name (required) and optional from (default main). main cannot be deleted.

await client.git.branches.list(projectId)
await client.git.branches.create(projectId, 'feature/nav', { from: 'main' })
await client.git.branches.delete(projectId, 'feature/nav')