How Do We Manage Code Branches at Alibaba?

Detailed Branching

When speaking about branch management, people generally restrict themselves to TrunkBased and GitFlow methodologies.

Introducing AoneFlow

AoneFlow is Alibaba’s alternative to GitfFlow. You will see the influences of some other branching methods in AoneFlow. It essentially combines the ease of continuous integration that comes with TrunkBased with the ease of management of GitFlow, while still avoiding tediousness of GitFlow.

Rule 1: Before starting the work, create a feature branch from master.

AoneFlow’s feature branches are based on those of GitFlow and do not feature any noteworthy changes. Each time the team begins a new task (for example a new feature or fixing an issue), they must first create a branch from the master that has been recently pushed to the production and give it a name that begins with “feature/.” Then, one can make changes in the code on this branch. That is to say, that each work item (it could be completed by one individual or by multiple developers collaborating), has a corresponding feature branch. One cannot submit a change directly to the master.

Rule 2: Generate the production branch by merging the feature branches.

The production branch of AoneFlow is quite intelligent, and it is the lifeline of the entire system. In Gitflow, you can first merge the completed feature branches with the common master (also called the development branch), and then pull it to the production branch. TrunkBased takes a similar approach by waiting for all necessary feature branches before you include them in the master and then pulls the production branch from a specific point on the master. AoneFlow’s approach, on the other hand, is to pull a new branch first from the master, then merge each of the feature branches that it needs to include in the present version onto this branch one by one, and thereby form the production branch. The name of a production branch usually begins with “release/.”

Rule 3: After pushing to the online environment, merge the corresponding branch to the master and add labels to the master, simultaneously deleting the feature branches related to that production branch.

Once the pipeline of a production branch has completed a deployment to the online environment, the corresponding features get released, and the production branch is merged to the master. In order to avoid accumulating outdated feature branches in the code repository, you should clear out the feature branches that you have already released. As in GitFlow, the newest master branch will always be different from the branch that’s currently online. If we have to roll back to a previous version, then all we have to do is find the correct tag on the master branch.

Optimizations of AoneFlow

Oftentimes, knowledge of techniques isn’t enough; practice and experience help people master new techniques. At Alibaba Cloud, our teams use similar dedication to develop great code using a complete set of tools. The habits we will be talking about here are not just about writing clean code and keeping branches organized, but also include a fair number of common conventions.

Automation of the Entire Workflow

Since it is an internal tool, the entire platform is incredibly cohesive. You can perform all project operations in one location. This includes determining project requirements, breaking them into tasks, creating online feature branches accordingly, integrating production branches, automatically creating test environment according to a template, all the way to post-production operation and maintenance.

Automating the Production Branch Pipeline

As a method of automating the workflow, the CI/CD pipeline is a common practice among many delivery teams. There are several code branches in an AoneFlow lifecycle, and when someone creates or updates any of these branches, a series of behavior must always follow. The pipeline is capable of connecting the branches generated by these daily development processes with the deep layer blueprints they represent (for example submitting code and then integrating it for testing). Particularly, each of AoneFlow’s production branches gets linked to a specific deployment environment, so we need to check and deploy the code in a timely manner.

Branch Connection Management

Maintaining the connected relationships between feature branches and production branches is a problem unique to AoneFlow. Remember that determining which feature branches decide the classification of a production branch is critical to know which groups of feature branches the production branch needs to change. For example, when we need to remove a feature from a specific production branch, we typically merge all of the features aside from the ones that need to be removed and use that branch to replace the original one. Recording all of this information is no small matter, so it is very helpful if we can display this information and aid in its operation through the platform.


There is no one-size-fits-all approach for code branching. However, the key is that the rate of release matches the scope of the project. Alibaba Cloud’s cooperative development platform AoneFlow has generated a complete set of branch management methods. It uses a flexible, highly effective, and simple to use workflow to ensure the delivery of all of the products under Alibaba Cloud’s flag. If you’re still not sure about which branching method to use, and cannot quite tear yourself away from Gitflow’s concurrent feature development, or do not want to part with the continuous integration features of TrunkBased, then AoneFlow may very well be worth your consideration.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: