Branches
This page will introduce the naming conventions for the different types of branches and highlight their specific use cases.
Main branch
The main
branch is the singular and first branch existing on a new repository.
It is used to represent the current state of the project, therefore it is most important to keep it in a stable state.
Danger
Direct work on the main
branch is forbidden!
The main
branch is used to track the latest release version of the project. A release is a traceable version of the project, and therefore the main
branch can be seen as an overview of the different releases, as seen below:
Note that the commits in the figure above are the result of merge operations from release branches.
Hint
We use Semantic Versioning to determine the version number of each release.
Release branches
Release branches serve as a staging area for the integration of new features and fixes.
A release branch has the prefix release/
followed by the future release version that will be published to main when the work on all features has been completed excluding the patch version: release/v<major>.<minor>.x
. For example, the branch release/v2.0.x
contains all the patches belonging to major version 2 and minor version 0.
While the state of the software on a release branch does not necessarily have to be stable, they are not intended to be worked on directly. For this reason, feature and bugfix branches are introduced.
Ready for release
Once all the features planned for the release have been implemented and the release branch is ready, a Pull Request (PR) can be started to merge it into main
.
Warning
A Pull Request (PR) must be performed to merge a release
into main
.
In an ideal world, the work on release v3.0.0 can begin after release v2.0.0 is completed and the new tag can be used as a branching point for the next release branch. In practice, shifting priorities and complexities will result in the need for parallel release branches as shown below.
Important
Do not delete the release/
branches after these have been merged to main
!
You can keep using them for future patches or bugfixes, or as reference for future development.
Feature branches
Feature branches are created to implement or change a distinct feature. There are no special restrictions on feature branches and work can be directly commited to a feature branch.
Feature branch naming convention is a prefix plus the name of the feature to be worked on, like feature/multiuser_support
or feature/client_rework
.
Warning
A Pull Request (PR) must be performed to merge a feature
into a release
.
Bugfix branches
Bugfix branches are indicated by the bugfix/<name>
naming sheme. They are used to solve identified issues in already existing releases.
To make these fixes available for already published releases, a special release branch can be created. For example branch release/v4.0.x
would serve as the way to release bugfix versions of release v4.0.0.
This allows for a cleaner main branch and the possibility to resolve issues in old releases without affecting the work for future software versions.
Warning
A Pull Request (PR) must be performed to merge a bugfix
into a release
.