Git branching strategies
In order of least to most complex, this guide describes the following Git-based branching strategies in detail:
-
Trunk – Trunk-based development is a software development practice in which all developers work on a single branch, typically called the
trunk
ormain
branch. The idea behind this approach is to keep the code base in a continuously releasable state by integrating code changes frequently and relying on automated testing and continuous integration. -
GitHub Flow – GitHub Flow is a lightweight, branch-based workflow that was developed by GitHub. It is based on the idea of short-lived
feature
branches. When a feature is complete and ready to be deployed, the feature is merged into themain
branch. -
Gitflow – With a Gitflow approach, development is completed in individual feature branches. After approval, you merge
feature
branches into an integration branch that is usually nameddevelop
. When enough features have accumulated in thedevelop
branch, arelease
branch is created to deploy the features to upper environments.
Each branching strategy has advantages and disadvantages. Although they all use the same environments, they don't all use the same branches or manual approval steps. In this section of the guide, review each branching strategy in detail so that you're familiar with its nuances and can evaluate whether it fits your organization's use case.