TeamCity 8.0 Help

Automatic Merge

The feature is available since TeamCity 8.1. The Automatic Merge build feature tracks builds in branches matched by a given filter and merges them into a specified destination branch if the build satisfies a certain merge condition. It is supported for Git and Mercurial VCS roots for build configurations with enabled Working with Feature Branches.

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.

Option

Description

Watch builds in branches

A Configuring VCS Triggers for Working with Feature Branches of the branches whose build's sources will be merged. Specify newline-delimited of rules in the form of +|-:logical branch name (with an optional * placeholder). Parameter references are supported here.

Merge into branch

A Working with Feature Branches of the destination branch the sources will be merged to. Parameter references are supported here.

Merge commit message

A message for a merge commit. The default is set to Merge branch '%\teamcity.build.branch%'. Parameter references are supported here.

Perform merge if

A condition defining when the merge will be performed (either for successful builds only, or if build from the branch does not add new problems to destination branch).

Merge policy

Select to create a merge commit or do a fast-forward merge.

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 the related TeamCity blog post.

Last modified: 20 April 2023