All Products
Search
Document Center

Alibaba Cloud DevOps:Branch mode

Last Updated:May 07, 2025

This topic introduces the concept, importance, and application of branch mode. Learn how to create and manage branches to better facilitate version control and collaborative development.

Branch mode

Alibaba Cloud DevOps Flows supports branch mode. You only need to focus on the integration and release of feature branches, and Flow helps you with the rest like creating, managing, and merging release branches.

Master branch

A master branch holds the most recent release (the tip). Create branches from the master branch and frequently merge from master, to minimize potential integration issues. Before a release, ensure that the release is based on the tip of the master branch.

Feature branch

A feature branch is typically used for fixing bugs, developing smaller-scale requirements, or executing subdivided jobs. Usually it is created from the tip of the master branch. Development and testing are conducted on it until the feature is fully implemented, and qualified for release.

Release branch

For integration

  • A release branch is used for integration and deployment. It is created from the tip of the master branch. Merge feature branches into this release branch for deployment and testing.

  • Every time a feature branch is merged into the release branch, deploy it and test it again.

  • If bugs are found, fix them on the feature branch first and then merge it into the release branch. We recommend that you abandon the feature branch if numerous or severe issues are found. Just create a new release branch, merge all the other feature branches into it, and exclude the problematic feature branch.

  • Release branches are managed by the system. Make all code modifications on feature branches - do not modify code on the release branch.

For deployment

If the release branch is qualified enough and has included all the intended features, you might want to deploy it. Ensure that it is merged into the master branch after deployment. The following figure shows how it works.

分支模式-fea-rel

For multiple environments

Deployment requires passing through multiple test environments (e.g., daily testing and pre-production testing), and using a single release branch is inappropriate. This is because features might be divided and deployed to different environments.

To solve this problem, associate each test environment with its own dedicated release branch. For instance, the daily testing and pre-production testing environments should each have their own isolated release branches to prevent mutual interference. The production environment should also corresponds to a dedicated release branch.

When transferring integration between environments, the standard practice is to create a new release branch from the master branch and merge the previous environment's release branch into this new branch. This ensures a clean and traceable promotion workflow while maintaining isolation between testing stages.分支模式-rels

How to apply branch mode in a pipeline

Build a pipeline with Branch Manager

  1. Click Add Pipeline Source.

  2. In the Code Repository section, select a code repository.

  3. Turn on Enable Branch Mode. (This will generate a pipeline that contains Branch Manager.)莫小@1x

  4. Click Add.

  5. Click Git Branch Manager Pre-release appears on the Process Configuration page.

  6. Set the Base Branch (default to master). Group@1x

Run the pipeline

  1. Click Save and Run in the upper-right corner.

  2. In the dialog that appears, click Add a running branch.Group@1x (1)

  3. Select running branches. (Multiple running branches can be added.)Group@1x

  4. Click Run.

  5. Click Git Branch Manager to view the execution results and logs. If a merge conflict occurs, resolve the conflict by following the on-screen instructions, and run the pipeline again.

  6. Click Branch Details in the Git Branch Manager to view branch details.Group@1xGroup@1x

  7. When running the pipeline again, you can add more branches by clicking Add a running branch, or delete integrated branches by clicking the trash button in the Actions column.Group@1x (1)

When deleting an integrated branch, executing the pipeline will:

  1. Create a release branch based on the base branch specified in the Branch Manager.

  2. Merge branches other than the deleted branch into the release branch.

  3. Run the pipeline based on the tip of the release branch.