---
title: "Create and manage branches"
description: "Create a test branch and compare schemas before changing data."
---

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

# Create and manage branches

A branch derives a timeline from a parent using copy-on-write. Use branches to test changes within a project. Copied data can still be sensitive: branching does not anonymize or mask it.

## Create a branch

1. Open a project and select **Branches**.
2. Create a branch, give it a name and select its parent.
3. Verify that the new branch belongs to the intended project and has the correct parent.
4. To run SQL on it, select or create an appropriate compute and [connect](/guides/connect/).

Independent computes on several branches are a new source contract dated 22 October 2026, not a production acceptance result from this documentation task. A successful branch creation does not establish that a compute has been provisioned.

## Compare schemas

Open **Schema diff**, select two branches and a database. Check the source and target direction before interpreting differences. Schema comparison shows structure; it does not automatically run migrations or merge data.

## Protect or delete a branch

Enable deletion protection to help prevent accidental removal. The `main` branch and protected branches cannot be deleted. New source also rejects deletion of a branch that still has a compute; handle the compute first.

Read the resource name and consequences in the confirmation dialog. After an error or timeout, refresh the list and state before retrying. Do not delete a branch serving an application without preparing its connection change.

Source: https://docs.pgnext.dev/guides/branches/index.mdx
