Skip to content

Branching Strategy

The overall branching strategy flow is:

  • A develop branch is created from main
  • A release branch is created from develop
  • Feature branches are created from develop
  • When a feature is complete it is merged into the develop branch
  • When the release branch is done it is merged into develop and main
  • If an issue in main is detected a hotfix branch is created from main
  • Once the hotfix is complete it is merged to both develop and main

Develop and main branches

Strategy

  • main branch is the main branch where the source code of HEAD always reflects a production-ready state.
  • develop branch is the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release.

Feature branches

Each new feature should reside in its own branch, which can be pushed to the central repository for backup/collaboration. But, instead of branching off of main, feature branches use develop as their parent branch. When a feature is complete, it gets merged back into develop. Features should never interact directly with main.

Feature

Release branches

When the develop branch has enough features or a release date is near, a release branch is created from develop. This starts the release cycle, allowing only bug fixes, documentation, and release tasks in this branch. Once ready, it merges into main, is tagged with a version number, and merges back into develop.

Release

Using a release branch allows one team to finalize the release while another works on new features. It clearly defines development phases, making it easy to see when the team is preparing for a specific release.

Hotfix branches

Maintenance or “hotfix” branches are used to quickly patch production releases. Hotfix branches are a lot like release branches and feature branches except they're based on main instead of develop. This is the only branch that should fork directly off of main. As soon as the fix is complete, it should be merged into both main and develop (or the current release branch), and main should be tagged with an updated version number.

Hotfix