> ## Documentation Index
> Fetch the complete documentation index at: https://code.storage/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# repo.listBranches()

> List all branches in the repository with pagination support.

> [!WARNING]
>
> This page documents the earlier Code Storage SDKs: `@pierre/storage`, `pierre-storage`, and
> `code-storage-go`. New code uses the [Pierre SDK](https://code.storage/docs/sdks.md). To move code to the new SDK, use the
> [`pierre-migrate`
> skill](https://github.com/pierrecomputer/skills/tree/main/skills/pierre-migrate).

```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
// List all branches
const branches = await repo.listBranches();
console.log(branches.branches); // Array of branch info

// With pagination
const page = await repo.listBranches({
  limit: 10,
  cursor: branches.nextCursor,
});

// List branches in the ephemeral namespace
const previews = await repo.listBranches({ ephemeral: true });
```

```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
branches = await repo.list_branches(limit=10)
print(branches["branches"])

# Use pagination cursor for the next page
next_page = await repo.list_branches(
    limit=10,
    cursor=branches.get("next_cursor"),
)

# List branches in the ephemeral namespace
previews = await repo.list_branches(ephemeral=True)
```

```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
// List branches with pagination
branches, err := repo.ListBranches(context.Background(), storage.ListBranchesOptions{Limit: 10})
fmt.Println(branches.Branches)

nextPage, err := repo.ListBranches(context.Background(), storage.ListBranchesOptions{
	Limit:  10,
	Cursor: branches.NextCursor,
})

// List branches in the ephemeral namespace
ephemeral := true
previews, err := repo.ListBranches(context.Background(), storage.ListBranchesOptions{
	Ephemeral: &ephemeral,
})
```

## Options

**limit** `string`

Maximum branches per page

**cursor** `string`

Pagination cursor from a previous response

**ephemeral** `boolean`

List branches from the ephemeral namespace instead of the default namespace (default: `false`)

## Response

**branches** `array`

List of branch info objects

**nextCursor** `string`

Cursor for the next page (absent when no more results)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.