> For the complete documentation index, see [llms.txt](https://docs.flosum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flosum.com/devops/code/branch-actions/deploying-a-branch.md).

# Deploying a Branch

Deployment pushes your branch’s metadata components into a target Salesforce org. It actually applies changes, making it the final step in moving code/config into Salesforce environments.

{% hint style="warning" %}

#### Written for the Old UI

This article was written for the old UI. The instructions are still usable, but the screenshots are outdated. In some cases, items referenced in the instructions have moved or changed. If you cannot find an item, see the [Where Did It Go](/devops/new-ui-ux-transition/where-did-it-go.md) article.
{% endhint %}

## ![](https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FG5ZbxX918xOHwbAwAJ4n%2FSummary2-Small-Icon.svg?alt=media\&token=da26a67f-ff7f-47b3-8669-06be960dc2d7) Overview <a href="#what-is-deploy" id="what-is-deploy"></a>

Deploying a branch lets you migrate metadata components from a Cloud DevOps branch to a Salesforce Organization that is connected to DevOps.

The deployment process ensures that:

* Selected branch components are applied to the target org
* Optional destructive changes can remove metadata no longer needed
* Apex tests and post-deployment steps run for compliance and stability

By running a deployment after validation, you can confidently promote changes to higher environments such as UAT and Production.

{% hint style="info" %}

#### Validation Recommended

Before deploying, conduct a validation job using the branch, components, and organization intended for deployment. Ensure the validation is successful before proceeding. For detailed validation instructions, refer to the following article.

* [Using Branch Validate](/devops/code/branch-actions/using-branch-validate.md)
  {% endhint %}

{% hint style="info" %}

#### Best Practices

* Always validate before deploying into UAT or Production.
* Use **Pre** and **Post** destructive changes carefully; confirm items are safe to delete.
* In production environments, always select **Run all tests** or **Run local tests**. In lower environments, you can select **Do not run tests** to enable faster deployments.
* Use Profile/Permission Set scoping to avoid unnecessary overwrites.
* Review logs carefully after deployment to confirm success.
* Leverage **Rollback** immediately if unexpected issues occur.
  {% endhint %}

## Run Branch Deployment Job <a href="#what-is-deploy" id="what-is-deploy"></a>

{% stepper %}
{% step %}

### Select a Branch and Start Deployment

1. Click **Code** from the left sidebar menu.
2. Select a branch from the list.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FowIktcJ0lJan93guER9t%2FDeployingABranch-S01-01.png?alt=media&amp;token=f7616efc-dc31-4e32-8058-2f7442b2a3bc" alt="" width="563"><figcaption></figcaption></figure></div>
3. Click **Deploy**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FLiqsWo46IYOcLuCpFV4x%2FDeployingABranch-S01-02.png?alt=media&amp;token=8b7f5be8-0723-4368-a454-8b60dcb0fa68" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Select Components and Organization

1. Click **Add** for each branch component to include in the deployment.
2. (Optional) Click **Add all** to add all components to the deployment.
3. Click **Next**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F7eUSGY5EsHqT9QrlGovD%2FDeployingABranch-S02-01.png?alt=media&amp;token=617ed586-6a1c-4e0e-b108-eb30fa302bb9" alt="" width="563"><figcaption></figcaption></figure></div>
4. Click **Select** to choose the Salesforce organization for deployment.
5. Click **Next**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FAlc0MmheCbhgNKE4O3Vg%2FDeployingABranch-S02-02.png?alt=media&amp;token=3b37fb89-529a-4d64-a8ba-0993c57d9ad8" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Select Destructive Changes

Components can be marked for **Pre** (delete before deploy) or **Post** (delete after deploy).

{% hint style="info" %}
By default, all pre- and post-destructive changes are added.
{% endhint %}

1. (Optional) To remove a destructive change from the deployment, click **Added** to unselect the component.
2. Click **Next**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FQTU0IdJnsWal0GEGCN7t%2FDeployingABranch-S03-01.png?alt=media&amp;token=7caefd43-6e5d-4610-ae88-d2bfb4c7f84e" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Configure and Run Deployment

1. Click the **Run tests** dropdown menu to choose the level of Apex testing to perform. See the table below for a description of each.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FGQysHY6ruIWKtmgsZFny%2FDeployingABranch-S04-01.png?alt=media&amp;token=39805d95-dd36-4aa7-b763-1ff557316615" alt="" width="563"><figcaption></figcaption></figure></div>

<table><thead><tr><th width="180.333251953125">Test Level</th><th>Description</th></tr></thead><tbody><tr><td><strong>Default</strong></td><td>Runs only the tests included in the package.</td></tr><tr><td><strong>Do not run tests</strong></td><td>Skips all Apex tests (allowed only in non-production orgs).</td></tr><tr><td><strong>Run local tests</strong></td><td>Executes all tests in the org except those from installed managed packages.</td></tr><tr><td><strong>Run all tests</strong></td><td>Runs every test in the org, including managed package tests.</td></tr><tr><td><strong>Run relevant tests</strong></td><td>Runs only the tests relevant to the selected components and their dependencies. This option uses Salesforce’s RunRelevantTests feature to automatically determine which tests to run. For more details, see <a href="https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_run_relevant_tests.htm&#x26;release=260&#x26;type=5">Salesforce Help</a>.</td></tr><tr><td><strong>Run specified tests</strong></td><td>Lets you define individual test classes or methods to run.</td></tr></tbody></table>

2. Click the deployment settings toggles to enable the settings. See the following table for an explanation of each setting.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FFFbssDZs5otsVf3UygrV%2FDeployingABranch-S04-02.png?alt=media&amp;token=c977ae4a-d791-465f-a4ee-c1d122db2bdc" alt="" width="563"><figcaption></figcaption></figure></div>

<table><thead><tr><th width="299.6666259765625">Setting</th><th>Description</th></tr></thead><tbody><tr><td><strong>Deploy profile settings only for selected components</strong></td><td>Only validate <strong>Profile Settings</strong> for the components you chose to include in this validation job.</td></tr><tr><td><strong>Deploy permission set settings only for selected components</strong></td><td>Only validate <strong>Permission Set Settings</strong> for the components you chose to include in this validation job.</td></tr><tr><td><strong>Run post deploy Apex code</strong></td><td>Executes defined Apex scripts after deployment completes. When enabled, a text box is available for entering scripts.</td></tr><tr><td><strong>Ignore warnings on deployment</strong></td><td>Allows deployment to continue even with warnings.</td></tr><tr><td><strong>Vlocity LWC Activation</strong></td><td>When enabled, Vlocity Lightning Web Components are automatically activated, compiled, and made runnable during deployment.</td></tr></tbody></table>

3. Click **Run** to start the Deployment job.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FJWKAGbdxEem2eTAUKLFw%2FDeployingABranch-S04-03.png?alt=media&amp;token=f5473c0f-1236-4b51-a9f2-5aba6643d1d1" alt="" width="563"><figcaption></figcaption></figure></div>
4. After starting the Deployment job, it will be displayed on the **Activities** tab.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F2t5B8UnapxQDMhJHOCAc%2FDeployingABranch-S04-04.png?alt=media&amp;token=5e4bbcd3-111d-47ea-ac00-4d79d3d6de25" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### In Progress Deployment

During a **Deploy** job that is **In Progress**, you can monitor its status and cancel it if needed.

1. Click the **In Progress** Deploy job.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FxwAKoWsgFqvMNpzdvX9P%2FDeployingABranch-S05-01.png?alt=media&amp;token=94441191-4fc7-4e4b-b025-562c584e240e" alt="" width="563"><figcaption></figcaption></figure></div>

**Refresh Logs**

1. Click **Refresh** to refresh the log view with the current log.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FtigTi8i0cyADr8dzA4JC%2FDeployingABranch-S05-02.png?alt=media&amp;token=51671cde-00be-40e3-91e7-8226ac504bd2" alt="" width="563"><figcaption></figcaption></figure></div>

**Abort Deployment**

1. Click **Abort**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FgRQtNO4iGhNYpmjn7ei9%2FDeployingABranch-S05-03.png?alt=media&amp;token=d34877fa-20f7-4732-b2cf-24292bef577a" alt="" width="563"><figcaption></figcaption></figure></div>
2. Click **Abort** in the **Abort Deploy** confirmation dialog.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F5f9vAiKB3r1OFyBfZkzS%2FDeployingABranch-S05-04.png?alt=media&amp;token=af38967f-6db5-46be-8ac5-d478e4afc07d" alt="" width="375"><figcaption></figcaption></figure></div>
3. The Deploy job has stopped, and no further actions will be performed on the Salesforce Organization.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FAG5y8QoNWB97veoy9riv%2FDeployingABranch-S05-05.png?alt=media&amp;token=d5ecf009-3e63-4274-a00b-20dd51401ea0" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}
{% endstepper %}

## Deployment Results <a href="#what-is-deploy" id="what-is-deploy"></a>

{% stepper %}
{% step %}

### View Results

1. Click the **Activities** tab.
2. Check that the **Deploy** job status is **Completed**.

{% hint style="info" %}
If an error occurs during the Deploy job, its status will change to **Exception**. Review the Deploy job log to identify the errors.
{% endhint %}

<table><thead><tr><th width="159.6666259765625">Job Status</th><th>Description</th></tr></thead><tbody><tr><td><strong>Queued</strong></td><td>Job is created and waiting to run.</td></tr><tr><td><strong>In Progress</strong></td><td>Job is running.</td></tr><tr><td><strong>Completed</strong></td><td>Job completed successfully.</td></tr><tr><td><strong>Exception</strong></td><td>Job completed with errors.</td></tr></tbody></table>

3. Click the **Deploy** job.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FmF98PxJFeGMb0bvk5Zq3%2FDeployingABranch-Results-S01-01.png?alt=media&amp;token=5640c5d7-4797-4066-829c-5f53b7f47540" alt="" width="563"><figcaption></figcaption></figure></div>
4. The **Deploy** results page lists job information and a detailed log.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F1rZSpL23RCv6D75yO9Uc%2FDeployingABranch-Results-S01-02.png?alt=media&amp;token=10af3e1e-e9c0-46d0-8079-165e821afa3e" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Review Log (No Errors)

In the Deploy job log, details include:

* Presence of Destructive Changes objects.
* Count and list of deployed components.
* Type and results of the Apex test run.
* Deployment steps completed.

<div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FmAcSWTgxb5kUxVfvgUZu%2FDeployingABranch-Results-S02-01.png?alt=media&amp;token=360bb5c6-704f-4ca8-a174-10b7422663f1" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Review Log (With Errors)

When a Deploy job encounters an error, examine the logs to identify the cause. Focus on entries marked with **\[error]**. The screenshots below show a Deploy job run in which a Salesforce org is missing multiple components required by the branch.

<div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FG1J7gVdeoXGGRbQp9U2N%2FDeployingABranch-Results-S03-01.png?alt=media&amp;token=f4a8c53f-82bb-4e2c-9ec9-fd04891d8204" alt="" width="563"><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FgG1QeRxJzyXlChyku2Ve%2FDeployingABranch-Results-S03-02.png?alt=media&amp;token=eaf8bbfe-4c31-4dc0-acb6-73a6ca631fd9" alt="" width="563"><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FzZCAyoz3OP53Ds2iskjS%2FDeployingABranch-Results-S03-03.png?alt=media&amp;token=1b4cc530-e158-4b96-b29c-7fd05208be08" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Rollback Deployment

On the deployment results page, if a backup was created, you will see a **Rollback** button. Clicking Rollback restores the organization to its state before the deployment, using the backup snapshot. For detailed instructions on this process, refer to the following article.

* [Rolling Back a Deployment](/devops/code/branch-actions/rolling-back-a-deployment.md)
  {% endstep %}
  {% endstepper %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flosum.com/devops/code/branch-actions/deploying-a-branch.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
