> For the complete documentation index, see [llms.txt](https://metalbear.com/mirrord/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://metalbear.com/mirrord/docs/sharing-the-cluster/db-branching/more/management.md).

# Branch Management

mirrord provides CLI commands to inspect and manage database branches:

| Command                                          | Purpose                                          |
| ------------------------------------------------ | ------------------------------------------------ |
| `mirrord db-branches status [name...]`           | Show the status of running database branches     |
| `mirrord db-branches destroy (--all \| name...)` | Destroy one or more running database branches    |
| `mirrord db-branches connections`                | List the currently active DB branch portforwards |

All commands accept `(-n\|--namespace) namespace` to select a namespace and `-A\|--all-namespaces` to operate across all namespaces.

### View Branch Status

```bash
mirrord db-branches [(-n|--namespace) namespace] [-A | --all-namespaces] status [name...]
```

* Shows the status of running database branches.
* If specific branch names are provided, mirrord shows their statuses.
* If no names are given, all active branches in the selected namespace (or all namespaces, if --all-namespaces is used) are listed.
* If no branches are active, mirrord returns:`No active DB branch found`

Example output:

| Name                                 | Pod Name                                 | DB Type    | Phase | TTL (sec) | Database               | Users           | Expires At                    |
| ------------------------------------ | ---------------------------------------- | ---------- | ----- | --------- | ---------------------- | --------------- | ----------------------------- |
| `mirrord-pg-branch-070081bc40967ac9` | `mirrord-postgresql-branch-db-pod-686qf` | PostgreSQL | Ready | 600       | `my_database_name_etc` | `minikube-user` | `2026-07-06T04:36:59.683405Z` |

### Destroy Branches

```bash
mirrord db-branches [(-n|--namespace) namespace] [-A | --all-namespaces] destroy (--all | name...)
```

* Destroys one or more running database branches.
* Use `--all` to destroy every active branch.
* Use one or more branch names to target specific branches.
* mirrord uses the default namespace, or the namespace specified with `--namespace`.
* To destroy branches across all namespaces, use `--all-namespaces`.
* If no active branches are found, mirrord returns: `Error: No active DB branch found`

### List Branch Portforwards

```bash
mirrord db-branches connections
```

* Lists the currently active DB branch portforwards, which are set up automatically while a session is active. See [Portforwards](/mirrord/docs/sharing-the-cluster/db-branching.md#portforwards).

Example output:

| DB ID                | Address                                                                                   | Key     | Session ID         |
| -------------------- | ----------------------------------------------------------------------------------------- | ------- | ------------------ |
| `pg-dev-random-id10` | `postgresql://postgres:postgres-branch-pod-root-password@[::]:53778/my_database_name_etc` | `40c85` | `5E68BB2A295FDC5E` |

When no session is active:

```
No active portforward sessions.
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://metalbear.com/mirrord/docs/sharing-the-cluster/db-branching/more/management.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
