Infrastructure / DevOps

Git branching strategies: Git Flow vs trunk-based

Git Flow, feature branches and trunk-based development compared: how each branching strategy works, what it costs, and which one fits how your team ships.

  • 7 min read
  • 5 questions
  • +35 XP
Transcript

Branching Strategies, explained by cats. Kitty works on a team. Many cats. One repository. Many opinions. One cat says: “Everyone commit to main.” Very brave. Very bad. So the team needs a branching strategy. That means: A rule for how branches are created, used, and merged.

One strategy is Git Flow. In this, there are 5 types of branches. The main branch stays stable. The develop branch collects new work. The feature branches come off develop for new features. The release branches prepare a launch. And lastly, the Hotfix branches fix disasters fast.

Very organized. Also... kind of a lot. Another strategy is Feature Branch Workflow. Each new task gets its own branch. feature-login. fix-cart. update-tuna. When the work is ready, Kitty opens a pull request, gets a review, then merges. Simple. Popular.

Good for most teams. Then there is Trunk-Based Development. Cats make tiny changes. Merge to main often. Usually behind feature flags. Less long-lived branches. Less merge pain. More discipline. So which strategy is best? Big release process? Git Flow can help.

Fast-moving team? Feature branches work well. Shipping constantly? Trunk-based is great. The point is not to make branches fancy. The point is less chaos, fewer conflicts, and one happy main branch. Those are branching strategies. Just different ways for cats to not break production.