---
title: "Staging from a branch"
url: https://docs.corefinity.com/guides/sites/environments-and-copies/staging-from-a-branch
type: guide
last_updated: 2026-11-13
feature: environment-from-branch
---
# Staging from a branch

Create a staging environment that runs one Git branch, with a copy of the site's database and uploads, and deploys again on every push.

## Before you start

- You can open the site in **Managed Websites**. Anyone who can open a site can create its environments.
- The site is a WordPress site. Other platforms start an environment empty or from a copy.
- A repository is connected on Production's **Deployments**: see [Connect a repository](/guides/sites/code-and-deployments/connect-a-repository).

## Create the environment from a branch

1. **Open the create dialog**

   Go to **Managed Websites**, choose the site, then **Environments** under **Code & backups**. Choose **Create environment**, then enter a **Name** and choose a **Size**.

2. **Choose A git branch**

   Under **Start from**, choose **A git branch**. The dialog shows the site's repository.

   _Screenshot: The Create a staging environment dialog with Start from set to A git branch: the repository, the list of branches with a filter, the environment to take the database and uploads from, and the Deploy on push switch._

3. **Choose the branch**

   Choose the **Branch** from the list; **Filter the branches** narrows it. If the list cannot be read, enter the branch name.

4. **Choose the data**

   Under **Take database and uploads from**, choose an environment, or **Nothing (start empty)**. The data is copied once, when the environment is created; the code comes from the branch.

5. **Choose when it deploys**

   Leave **Deploy on push** on to deploy the environment on every push to the branch. Turn it off to deploy by hand.

6. **Create it**

   Choose **Create environment**. The environment is created, the data is copied, then the branch is deployed with the site's pipeline.

When it is ready, the environment's **Deploy** column in **Environments** shows **Git**, the branch and **on push**. If the first deployment fails, the environment still exists: open **Deployments** to see why.

The environment starts like any other staging environment, and its login is shown once when it is ready: see [Create an environment](/guides/sites/environments-and-copies/create-an-environment).

## Automate this

**API:** [Create a staging environment](https://docs.corefinity.com/api/reference/environments/create-site-environment.md), scope `write`

```bash
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/environments \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Review",
    "slug": "review",
    "source": {
      "environment_id": 1043,
      "scope": "files_db",
      "type": "clone"
    }
  }'
```

**MCP:** [`corestack_environment_create`](https://docs.corefinity.com/mcp/tools/corestack_environment_create.md), scope `write`

```json
{
  "name": "corestack_environment_create",
  "arguments": {
    "site_id": 4211,
    "name": "Staging",
    "source": {
      "type": "empty"
    }
  }
}
```

**Control Panel:** Managed Websites › your site › Code & backups › Environments ([https://manage.corefinity.com/go/environments](https://manage.corefinity.com/go/environments))

## Related

- [Create an environment](/guides/sites/environments-and-copies/create-an-environment): Add, rename or delete a staging environment.
- [Connect a repository](/guides/sites/code-and-deployments/connect-a-repository): Switch a site to Git deployments.&#xA;
