Trunk-based development
Trunk-based development is a source-control branching model, where developers merge small and frequent updates to a single branch (often called a trunk, but in git
, this is commonly referred to as the main
branch) and resist any pressure to create other long-lived development branches (see https://trunkbaseddevelopment.com).
The base idea is that the main branch is always in a clean state so that any developer, at any time, can create a new branch based upon the main branch that builds successfully.
To keep the branch in a clean state, developers must take multiple measures to ensure only code that does not break anything is merged back to the main branch, as outlined here:
- Fetch the newest changes from the main branch
- Perform a clean test
- Run all tests
- Have high cohesion with your team (pair programming or code review)
As you can see, this is predestined for a protected main branch and pull requests (PRs) with a CI build that...