What counts as trunk?
Trunk is the main branch of the repository, around which all development is organized in Trunk-Based Development.
Simply put: trunk is the "trunk of the tree", the main line of development.
What is usually considered trunk
Depending on the project and its settings, this can be:
main- the most common choice todaymaster- in older repositoriestrunk- less often, but it does occur (especially in older systems)
The name is not what matters - the role matters more than the name.
Key features of trunk
For a branch to count as trunk, it must:
- Be the only main branch
- Accept frequent integrations
- Always be in a working state
- Be the source of releases
- Be used by the whole team
What is NOT trunk
developin Gitflow- long-lived feature branches
- release or hotfix branches
These are auxiliary, not central.
Trunk in real practice
In Trunk-Based Development:
- all changes quickly land in trunk
- feature branches, if they exist, live very briefly
- trunk constantly goes through CI
- trunk can be deployed at any moment
A frequent interview question
Can the develop branch be considered trunk?
No, in the classic understanding of TBD, trunk is a branch that:
- gets deployed
- reflects the current state of the product
develop is a Gitflow concept, not a TBD one.
Short answer for an interview
Trunk is the main branch of the repository (usually
mainormaster), around which all development is organized, and into which the whole team's changes are integrated frequently and regularly.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.