DEV Community

Discussion on: Git Flow or Trunk-based Development?

alediaferia profile image
Alessandro Diaferia • Edited on

Trunk-based development does not necessarily negate branches. The idea is that you can still use them for pull-requests before mergeing back into master as long as such branches are kept small in size. Definition of small, of course, changes and is contextual to the project but the goal is that the changes are so small that they get checked in as frequently as possible. Checking into master as frequently as possible, coupled with continuous deployment, ensures that in case of failures the issues are easy to address because the amount of changes since the last successful deployment is very small.
Trunk-based development is usually coupled with feature flags because you still want control over whether to enable a functionality or not, regardless of the code being already in production or not. This is especially useful while the functionality is still in development.

I personally strive for trunk-based development because it forces you to think in terms of continuous flow of work but requires discipline as well as an additional preparatory work to enable it.