Branch mode lets you manage feature, release, and master branches for streamlined version control and team collaboration.
What is branch mode
Alibaba Cloud DevOps provides robust support for branch mode. You focus on which feature branches to integrate and release, while the system automates creating, managing, and merging release branches.
The following sections describe how to use each type of branch.
The master branch represents the latest release
The master branch represents the latest release of your project. To minimize integration issues, create other branches from master and merge from master frequently. Before releasing software, ensure it is up-to-date with the latest master branch.
Develop on feature branches
Use a feature branch to develop a specific feature, fix a bug, or complete a sub-task of a larger work item.
Create a feature branch from the latest version of the master branch. Then, develop and test on the feature branch until the feature is complete, meets quality standards, and is ready for integration and release.
Integrate on a release branch
Use a release branch for integration and release. Create a release branch from the latest version of the master branch, and then merge the desired feature branches into it for deployment and testing.
If a new feature branch needs to be included in the integration, merge it into the release branch and then deploy and test again.
If testing reveals issues, fix them on the feature branch before merging it again into the release branch. If a feature has too many problems, you can abandon it by creating a new release branch that includes all other feature branches except for the problematic one.
The system manages the release branch automatically. Do not modify code directly on the release branch. All code changes must be made on feature branches.
Deploy from a release branch
When a release branch is stable and feature-complete, it is ready for deployment. Before deploying, ensure it is up-to-date with the latest base branch, such as the master branch. After deployment, merge the release branch back into the master branch so that it represents the latest release.
The following figure illustrates this process:

Handle multiple environments
If your release process involves multiple test environments, such as daily testing and pre-production testing, a single release branch may not be sufficient. Different environments might test different sets of feature branches at the same time.
To address this, associate each test environment with a dedicated release branch. The daily testing and pre-production testing environments then have separate, isolated release branches, which prevents them from interfering with each other. The production environment also has its own release branch.
To promote the integrated code from one environment to the next, create a new release branch from the master branch. Then, merge the release branch from the previous environment into this new one.
The following figure illustrates this process:

The following section explains how to use branch mode in a pipeline.
Using branch mode in a pipeline
Configure the pipeline
Creating a branch mode pipeline follows the same process as other pipelines. When you create a pipeline, select Enable Branch Mode to automatically create a branch mode pipeline that includes the Branch Manager.
-
Create a new pipeline.
-
Add a code source. For example, to use Alibaba Cloud DevOps Codeup, select a code repository, select Enable Branch Mode, and then click Add.

-
After you add the source, the Git Branch Manager appears as the first stage on the Process Configuration page. In the Branch Manager, set the Base Branch, which defaults to the master branch. The release branch is created from this base branch, and the running branches are merged into it. The Git Branch Manager can only be configured in the first stage and does not support parallel tasks.

Run the pipeline
After you configure the pipeline, run it by performing the following steps.
-
In the run configuration, add the running branches for this execution.

-
In the Add a running branch dialog, select your running branches. If you are using a different code repository, enter the running branch names manually. You can add multiple branches.

-
After you add the running branches, run the pipeline. You can view the execution results and logs in the Git Branch Manager card. If a merge conflict occurs, resolve it according to the instructions and then run the pipeline again.
-
Click View Branches or Branch Details to view details of the created release branch and the running branches.


-
When you run the pipeline again, you can add more branches or remove previously integrated ones.

If you remove an integrated branch, the pipeline performs the following actions on the next run:
-
A new release branch is created from the base branch (for example, the master branch) defined in the Branch Manager.
-
All other configured branches in Alibaba Cloud DevOps, except for the one you removed, are merged into the new release branch.
-
The pipeline then runs using the latest content of the new release branch.
-



