# Automating the Merge Process

### Overview

The **Run Merge process on successful deployment** feature keeps track of builds in source branches and merges them into a designated destination branch if they meet the configured criteria (for example, the build is successful). Rather than requiring manual effort, upstream merges can now be automated by the Salesforce Release Manager using revision numbers that were determined as part of a build cycle in CI jobs.

> The feature is supported for the following CI jobs:
>
> * Package and deploy SFDX source from version control
> * Deploy from version control

### Automating Merge Process Settings

#### Enabling auto-merge

You will find the **`On Successful Deployment > Run Merge Process`** checkbox under the **`Deploy`** section when you create a CI job in ARM and fill out all required details in the **`Build`** section (such as *version control repository, branch, and revisions*).

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FPXgSjZgS0nNliArKhUGg%2Fimage.png?alt=media&#x26;token=e9a0014e-e97f-4dc1-8292-af978b273b7f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FcYxOpzfAepXqhXUTqa6J%2Fimage.png?alt=media&#x26;token=4fd70761-5a97-4ab8-8b32-670889dcfb73" alt=""><figcaption></figcaption></figure>

**Configuring auto-merge**

The following fields must be configured to start a merge when the build succeeds:

| Option                  | Description                                                                                                                                                                                                                                                         |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Repository Type         | Types of version control, example: Git, TFS.                                                                                                                                                                                                                        |
| Repository              | Based on the version control type selection, select your repository.                                                                                                                                                                                                |
| From Branch             | Specify the branch whose builds' sources will be merged.                                                                                                                                                                                                            |
| To Branch               | The destination branch the sources will be merged to.                                                                                                                                                                                                               |
| Merge Conflict Strategy | Specify the way to resolve the merge conflict if occurs.                                                                                                                                                                                                            |
| Resolve Type            | Choose merge method, i.e., **dry run** (shows how the merge will execute without making any changes) or **merge** (commits the changes).                                                                                                                            |
| Merge Type              | Type of merges supported in ARM, i.e., *entire branch, single revision, commit label, release label, alm label*.                                                                                                                                                    |
| Create GIT Tag          | Create a GIT tag. GIT tags are a simple and effective way to ensure you can keep track of the different versions of your code and the critical quality of Git's version control. GIT Tag operation allows meaningful names to a specific version in the repository. |

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FStJ51FV2odICYjirOfP9%2Fimage.png?alt=media&#x26;token=700c148e-d2f6-45d7-b838-6da95857c81a" alt=""><figcaption></figcaption></figure>

Users will be notified via email of the success or failure of the automated merge process.

**Merge-built revisions only**

A new checkbox called **`Merge built revisions only`** is newly added under the **`Deploy > On Successful Deployment > Run Merge Process`** section. On selection of the above-mentioned checkbox, ARM cherry-picks revisions identified as part of a build cycle to append them to the destination branch per the user's choice.

| Option                  | Description                                                                                                                              |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| To Branch               | The destination branch the sources will be merged to.                                                                                    |
| Merge Conflict Strategy | Specify the way to resolve the merge conflict if it occurs.                                                                              |
| Resolve Type            | Choose merge method, i.e., **dry run** (shows how the merge will execute without making any changes) or **merge** (commits the changes). |
| Create GIT Tag          | Create a GIT tag.                                                                                                                        |

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F1aUwqtiJxvVeh2KR0AqW%2Fimage.png?alt=media&#x26;token=1dbccca7-6f31-4594-bbe7-a8a01d33e811" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Point to Note:**

1. Selecting the **Merge built revisions only** checkbox will disable the current merge process.
2. Users will be notified via email of the success or failure of the merge process.
   {% endhint %}
