TeamCity
 
You are viewing the documentation for an earlier version of TeamCity.

Automatic Merge

Last modified: 20 April 2023

The Automatic Merge build feature tracks builds in branches matched by the configured filter and merges them into a specified destination branch if the build satisfies the condition configured (e.g. the build is successful). The merge occurs after the build finishes. The feature is supported for Git and Mercurial VCS roots for build configurations with enabled feature branches. TeamCity also allows merging branches manually.

Automatic Merge Settings



Check Adding Build Features for notes on how to add a build feature. All branches that are used in this feature must be present in a repository and included into the Branch Specification of the current build configuration.

Cascading Merge



It is possible to define a cascade of merge operations by adding several such features to a build configuration.

For example, you want to automatically merge all feature branches into an integration branch, and then configure another merge from the integration to the default branch.

  1. Create the integration branch on your VCS repository.

  2. Add the Automatic Merge build feature to your configuration.

    1. In the Watch builds in branches filter, specify

      +:feature-*
    2. In the Merge into branch, specify your integration. This will merge your feature branches to the integration branch.

  3. Add one more Automatic Merge build feature to your configuration.

    1. In the Watch builds in branches filter, specify

      +:integration
    2. In the Merge into branch, leave your default branch.

See also a related TeamCity blog post.