> For the complete documentation index, see [llms.txt](https://docs.revvy.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.revvy.io/devops-app/devops-app-devops.revvy.io/code/add-pre-and-post-destructive-changes-to-a-branch.md).

# Add Pre and Post Destructive Changes to a Branch

### What Are Destructive Changes?<br>

Destructive changes allow you to delete metadata from a Salesforce org as part of a deployment. For example, you may want to remove unused fields, classes, or components that are no longer required. In Revvy, destructive changes can be applied:

* **Pre-destructive changes** – deletions occur before the main deployment.
* **Post-destructive changes** – deletions occur after the main deployment.

<figure><img src="/files/9cHpmgZwrnZH8DOe4sMP" alt=""><figcaption></figcaption></figure>

### Adding Destructive Changes

1. In the **Components tab** of a branch, scroll down to the **Destructive Changes section**.
2. Click **Add Pre Destructive Changes** or **Add Post Destructive Changes**.
3. Select the source:
   * **Connection** – choose a Salesforce org to pull metadata from.
   * **Branch** – choose an existing branch.
4. Select the components you want to delete.
5. Click **Add** to include them in the destructive changes list.

### Managing Destructive Changes

* Once added, components appear in the **Destructive Changes** section with their deployment type (Pre or Post).
* Use the **three dots menu** to:
  * **Edit** – change the deployment type (switch between Pre and Post).
  * **Delete** – remove the destructive change entry.

### Deployment

When you run a **Deploy or Validate action**, destructive changes are included automatically. They execute in sequence depending on whether they are Pre or Post.

### Best Practices

* Use **Pre** destructive changes to remove metadata that might conflict with the new deployment.
* Use **Post** destructive changes for cleanup after the new components are deployed.
* Always validate deployments with destructive changes to ensure no critical metadata is deleted by mistake.


---

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.revvy.io/devops-app/devops-app-devops.revvy.io/code/add-pre-and-post-destructive-changes-to-a-branch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
