Marcio Cunha

How to organize complex workflows with Git Flow and Trunk-Based

Learn how to combine Git Flow and Trunk-Based Development to accelerate continuous software delivery without compromising stability in complex projects.

Marcio Cunha•4 min
Also available in:PortuguêsEspañol
Summary
  • Git Flow isolates stable versions in parallel production branches.
  • Trunk-Based Development accelerates continuous integration directly on the root branch.
  • Complex projects require hybrid approaches to balance security and velocity.
  • Feature flags allow testing incomplete code without breaking the main system.
  • Rigorous test automation ensures code health in fast-paced workflows.

The challenge of balancing speed and stability

Organizing code for a technology team often feels like trying to pack a small suitcase with clothes for all four seasons. On one hand, developers want to deliver new features quickly to the end user. On the other, infrastructure and security engineers demand exhaustive testing to prevent the system from crashing on a busy workday. At the center of this dilemma are branching strategies, which dictate how code versioning is managed in Git.

In practice, this means deciding how and when programmers share their local work with the central company repository. As teams grow and digital products become more complex, the traditional model of storing everything in a single cluttered branch stops working. Teams must choose between structured flows, like the classic Git Flow, and approaches focused on absolute speed, such as Trunk-Based Development (TBD), which prioritizes the main code trunk.

To understand how to navigate these options, it helps to remember that modern development requires systemic resilience similar to what we strive for when protecting microservices from cascading failures with circuit breakers, where every part of the system absorbs faults without bringing down the whole. The chosen Git strategy defines the pace at which this resilience is built and tested before reaching the user.

What Git Flow is and when it still makes sense

Git Flow is one of the most traditional software engineering approaches, designed for projects with well-defined release cycles, such as banking apps or enterprise software sold in packaged versions. In this model, code lives in distinct, well-defined branches: the main branch holds what is currently running in production, while a development branch (develop) accumulates the daily work of programmers.

When someone needs to build a new feature, a specific feature branch is opened from develop. Once the task is completed, that branch is merged back into the development environment. The major turning point happens when the company decides to release a version: a release branch is created for final bug fixes, while future changes continue in parallel without disrupting the stability of the upcoming release.

In practice, this rigid separation acts as a safety belt for large teams working on legacy code or heavy monolithic systems. However, the price of this safety is slowness. The accumulation of changes in parallel branches often generates complex merge conflicts, requiring hours of meetings and tedious manual code reviews.

The relentless agility of Trunk-Based Development

In direct contrast to the structured model, Trunk-Based Development (TBD) proposes that all developers integrate their changes directly into the project's primary branch, called trunk or main, multiple times a day. There are no long-lived branches or complex parallel versions; the code being written right now is merged almost in real time with colleagues' work.

To prevent incomplete or buggy code from breaking the production system, TBD heavily relies on two foundational practices: fast automated tests and the use of toggle controls called feature flags. Feature flags act like virtual light switches in the code, allowing a new screen or feature to be deployed to the main server while remaining invisible to the end user until fully polished.

Adopting this culture requires technical maturity and rigorous automation, bearing a strong resemblance to the discipline needed when designing realistic load tests with K6 for microservices, ensuring the system handles heavy daily integration volumes without performance degradation or concurrency faults.

How to combine the best of both worlds

Many modern companies have discovered they do not need to choose sides absolutely. It is entirely feasible to adopt a hybrid strategy that uses Trunk-Based Development concepts for daily internal service and API development, while reserving Git Flow's rigor for customer-facing releases or modules requiring strict third-party compliance.

The key to this harmony lies in automating the continuous integration and delivery (CI/CD) pipeline. When every change pushed to the repository undergoes a battery of unit tests, static security scans, and dependency checks within minutes, the fear of breaking the application vanishes, allowing diverse teams to collaborate smoothly.

Furthermore, cultural alignment is indispensable. Developers must understand that responsibility for system stability does not rest solely on the code reviewer or the quality assurance team, but rather on the person who wrote the initial line and decided to merge it into the organization's main workflow.

Final considerations on workflows

Choosing between Git Flow and Trunk-Based Development is not about following a fleeting industry fad, but about aligning your workflow architecture with product reality and team maturity. Projects with multiple external maintainers and sporadic releases benefit from isolated branch predictability, whereas agile digital products and SaaS rely on the surgical speed of daily trunk integrations.

The secret to success lies in the ability to adapt tools to real needs, investing in robust automation, observability, and a fast feedback culture. By eliminating friction when merging code, software engineering ceases to be a bureaucratic bottleneck and becomes the primary engine of business innovation and sustainable growth.