Skip to content
For the complete Netlify documentation index, see llms.txt. Markdown versions of any documentation page are available by appending .md to its URL.

Branch deploys

Branch deploys give any branch in your Git repository its own live URL, updated automatically whenever you or a teammate push changes. Use branch deploys to maintain persistent environments for staging, QA, feature review, localization, or to serve different versions of your site, such as for localization.

A branch deploy is a deploy generated from a specific branch of your Git repository. Each branch gets its own live URL that updates automatically when you push changes, giving your team a shareable, always-current version of the work on that branch. Unlike a Deploy Preview, which is generated per pull request, a branch deploy persists as long as the branch exists.

Note that Netlify doesn’t add an X-Robots-Tag: noindex header to the most recent branch deploy for each branch, so it can be indexed by search engines. Learn how to prevent this.

Branch deploys are useful for teams that need persistent, shareable environments beyond what pull request previews provide.

Common use cases include:

  • Set up a shared branch for previews before a major release, such as staging or an even more specific name for a release
  • Maintain a qa or beta branch with a persistent URL so testers always have a live environment to work against
  • Keep a feature branch deployed over time so stakeholders can review it without waiting for a pull request
  • Wire a dedicated branch (e.g. cms-preview) to draft content from a headless CMS for previewing unpublished changes
  • Serve localization or regional variants of your site from separate branches, each with its own URL

Branch deploys are published to a URL that includes the branch name and two hyphens (--) as a prefix. For example, a branch called staging deploys to staging--mysitename.netlify.app.

If you use Netlify DNS, you can enable branch subdomains so that the same staging branch deploys to staging.yourcustomdomain.com instead. Learn more about custom branch subdomains.

You can set up a branch deploy for a specific branch or for all new branches in your repository through your project configuration.

By default, Netlify will not generate a branch deploy unless a Developer or Owner has set up branch deploys for your site.

Set up a branch deploy for specific branches

Section titled “Set up a branch deploy for specific branches”

To set up a branch deploy for one or more specific branches, such as staging or qa:

  1. Go to Project configuration Developer settings Continuous deployment Branches and deploy contexts, and select Configure.

  2. Select Let me add individual branches and enter the name of each branch you want to deploy. You can also enter branch names you haven’t created yet in your repository. To deploy all branches with a specific prefix, add an asterisk to the end of your branch name, e.g. features/*.

  3. To confirm, select Save.

Set up branch deploys for all new branches

Section titled “Set up branch deploys for all new branches”

To automatically generate branch deploys for every new branch pushed to your remote site repository:

  1. Go to Project configuration Developer settings Continuous deployment Branches and deploy contexts, and select Configure.

  2. Next to Branch deploys, select All. This excludes the designated production branch for your repository.

  3. To confirm, select Save.

To turn off all branch deploys for your site:

  1. Go to Project configuration Developer settings Continuous deployment Branches and deploy contexts, and select Configure.

  2. For Branch deploys, select None.

  3. To confirm, select Save.

Branch deploys run under the branch deploy context, which lets you set different environment variables or build behavior without affecting your production build.

In netlify.toml, use [context.branch-deploy] to apply settings to all branch deploys, or [context.your-branch-name] to target a specific branch:

[context.branch-deploy]
command = "npm run build:staging"
[context.staging]
command = "npm run build:staging-special"

Learn more about deploy contexts, Netlify's equivalent of environments, where each context (production, branch-deploy, deploy-preview, or a named branch) represents a distinct stage of your workflow with its own configuration.

Protect all branch deploys with a password

Section titled “Protect all branch deploys with a password”

You can control who can access your site's branch deploys by requiring a password. Learn more at our Password Protection docs.

Prevent branch deploys from being indexed by search engines

Section titled “Prevent branch deploys from being indexed by search engines”

Netlify adds an X-Robots-Tag: noindex header to Deploy Previews and older branch deploys, but not to the most recent deploy of each branch. This means a URL like staging--mysitename.netlify.app can be crawled and indexed if search engines discover it.

To keep branch deploys out of search results, we recommend you set your project to private using project visibility (Credit-based plans only) or set up Password Protection scoped to non-production deploys. Both options prevent search engines and unauthorized visitors from accessing your branch deploys.

For a broader overview of how Netlify handles indexing across deploy types, see Search engine indexing.

You can assign custom branch subdomains to your branch deploys using your site's primary custom domain. Learn more about custom branch subdomains for branch deploys.