What are git branching strategies for CI and how do GitFlow and trunk-based development compare?
Answer
GitFlow uses multiple long-lived branches: main (production), develop (integration), feature/*, release/*, and hotfix/*. It suits teams with scheduled releases but creates complex merge workflows and long-lived branches that diverge significantly, making integration painful. Trunk-based development has all developers commit directly to the main branch (or merge short-lived feature branches within 1-2 days). This forces continuous integration — conflicts are resolved immediately and the branch is always releasable. It requires feature flags to hide incomplete work. Trunk-based development is the strategy used by high-performing engineering teams (Google, Facebook) because it maximizes integration frequency and minimizes merge conflicts. The CI pipeline is simpler with trunk-based development: there is only one primary branch to build and protect.
Previous
What is a Dockerfile and why does it matter in CI/CD?
Next
How do unit tests fit into a CI pipeline?