# Branch a computer

> Create a computer with its own copy of the source's data disks

> Nevia is in beta and open to selected teams. Public launch in Dec 2026. The CLI installs with `curl -fsSL https://get.nevia.cloud | sh`, and the MCP server is at https://api.nevia.cloud/mcp. A person signs in once in the browser.
> Setup, sign-in and requesting access: [SKILL.md](https://nevia.cloud/SKILL.md). When Nevia fits and when it doesn't: [why.md](https://nevia.cloud/why.md).

> For the complete documentation index, see [llms.txt](https://nevia.cloud/llms.txt). This page's HTML version: https://nevia.cloud/docs/computers/branch

Branch `demo` as `demo-branch`, change the branch's data, and confirm `demo`
stays the same. A branch of a running computer starts from the source's image
and private copies of its data disks, and keeps the same environment and size.
To restore saved memory as well as disks, [create and restore a checkpoint](https://nevia.cloud/docs/computers/checkpoints.md).

You need the [CLI installed and signed in](https://nevia.cloud/docs/get-started/quickstart.md), with a
[selected workspace](https://nevia.cloud/docs/workspaces/select.md) where you have the admin or editor role.
Use `demo` from
[Create a computer](https://nevia.cloud/docs/computers/create.md), and keep the name `demo-branch` free.

The example writes a file to your home directory, which lives on the computer's
persistent disk and is where commands start. That disk exists only when the
deployment has a storage pool. Files written elsewhere in the container's
writable filesystem don't carry over when you branch a running source.

## Branch

```bash
nevia status demo
```

You can branch a `ready` or `sleeping` computer with no pending transition or
running operation. This example uses `ready` so you can [run commands](https://nevia.cloud/docs/computers/exec.md)
on both computers. If `demo` is sleeping, [wake it](https://nevia.cloud/docs/computers/lifecycle.md) first.

Write a small scratch file:

```bash
nevia exec demo -- sh -c 'printf "original\n" > branch-note && sync'
```

A running source can reuse a disk snapshot less than five seconds old, so wait
five seconds after writing the file. Otherwise the branch may miss it:

```bash
sleep 5
nevia branch demo-branch --source demo --wait
nevia status demo-branch
```

`demo-branch` should be `ready`, with no pending transition. The source keeps
running; disk writes pause briefly while it takes a fresh snapshot.

## Check the copy

Read the file on the branch:

```bash
nevia exec demo-branch -- cat branch-note
```

It prints `original`. Overwrite the branch's copy, then read both files:

```bash
nevia exec demo-branch -- sh -c 'printf "branch\n" > branch-note'
nevia exec demo-branch -- cat branch-note
nevia exec demo -- cat branch-note
```

The branch prints `branch`. The source still prints `original`.

## Clean up

If you protected the branch, clear protection before deleting it. Deleting it
also removes any checkpoints you took of it, and fails while a live computer
restored from those checkpoints exists.

Delete the branch and its data:

```bash
nevia rm demo-branch --yes --wait
```

Remove the source's scratch file:

```bash
nevia exec demo -- rm branch-note
```

See [Computer lifecycle states](https://nevia.cloud/docs/reference/computer-lifecycle.md) for deletion
constraints and [`nevia branch`](https://nevia.cloud/docs/reference/cli/branch.md) for command options.
