Skip to main content
// List commits from default branch
const commits = await repo.listCommits();

// List commits from specific branch
const branchCommits = await repo.listCommits({
  branch: "feature/new-auth",
  limit: 20,
});

// List commits from an ephemeral branch
const previewCommits = await repo.listCommits({
  branch: "preview/pr-123",
  ephemeral: true,
});

const pathCommits = await repo.listCommits({
  branch: "main",
  path: "docs/guide.md",
});

Options

branch
string
Branch name to list commits from. Defaults to the default branch.
limit
number
Maximum number of commits to return
cursor
string
Pagination cursor from a previous response
ephemeral
boolean
Resolve branch against the ephemeral namespace instead of the persistent one (default: false)
path
string
Limit history to commits that touched a file or subtree.

Response

commits
array
List of commit objects.
nextCursor
string
Cursor for the next page (absent when no more results). Python: next_cursor; Go: NextCursor.
hasMore
boolean
Whether additional pages are available. Python: has_more; Go: HasMore.