DEV Community

Kevin Gida
Kevin Gida

Posted on

Trunk Based Development (TBD) ?

This post will cover a basic of Trunk Based Development.

What is Trunk Based Development?

The easiest way to explain TBD is we have one single branch (usually main branch) with open access to it, and every developer work directly on that branch.
With this approach we embrace Continuous Integration, prioritize agility and fostering collaboration.

Pros :

  • Always release ready
  • Minimize merge conflict
  • Quick iteration
  • Encourage small batches of work and CI/CD
  • Create robust code by encouraging refactoring
  • Leaner codebase

Cons :

  • Requires discipline and communication among developer
  • Relies on a lot of automatic testing
  • Not ideal for larger projects

Separate deployment from release. The idea is we are comfortable to deploy partially completed feature into production that is not yet “release” in a sense of available for people to use.There are many start with this type of release, But these are the 3 most common:

  1. Dark launching
    We are deploying features that don't affect the end user or people can't see yet. For example it could be a piece of code that is not used yet, or we build the backend for some feature before adding the UI at the end.

  2. Branch by abstraction
    Great technique to release big changes incrementally. Improve the abstraction in our code step by step to make cleaner interfaces overtime to improve its modularity. THEN, start to replace small component in our system with new one over many deployment and release

  3. Feature Flag
    We hide a new incomplete feature behind a software switch or flag. We continue to develop a new feature behind a flag, and when it's ready to release we flip the switch.

Git tips :

git pull -r
This command makes sure the latest changes from origin are fetched before rebasing on top of them.

git stash
Helps you with this by stashing your changes locally.

git rebase
Git rebase (opposite to Git merge) integrates changes from one branch onto another by moving or reapplying commits to the tip of the target branch, creating a linear history.

Top comments (3)

Collapse
 
colinnordmark profile image
Colin Nordmark

Really educational, thank you!

Collapse
 
marisa-pinheiro profile image
Marisa Pinheiro

Amazing intro, I'm saving this for latter!

Collapse
 
alexanderwestergard profile image
Alexander Westergård

Really awesome introduction to TBD - thank you!