# Git Branching Strategies

> How teams decide which branches exist and how work gets back to main. Trunk-based development against Git Flow, and where a monorepo fits in.

**Course:** [Git and GitHub](https://learn.benibix.com/learn/development-version-control)  
**Time:** 13 min

**After this lesson you can:**

- Say what a branching strategy decides
- Compare trunk-based development and Git Flow
- Pick a strategy for your team

## Trunk-based development or Git Flow

A branching strategy is a team's rules for branches: which ones exist, how long they live, and how work gets back to main. The two best known are trunk-based development and Git Flow. Trunk-based teams merge into main at least once every 24 hours. Git Flow keeps two long-lived branches and three short kinds.

In trunk-based development, everyone works on one main branch, called the trunk. Branches, if any, are tiny and last a day or less. Small changes join often, so conflicts stay small. Tests run on every merge, because a broken trunk breaks everyone at once.

Half-done work still lands on the trunk, hidden behind a feature flag. A feature flag is a switch in the code that keeps a new feature off for users until it is ready. The code ships every day. The feature appears when someone turns the switch on.

Git Flow was set out in a blog post in 2010. Main holds what is live, and develop holds the next release. Feature branches come off develop and merge back into it. A release branch carries develop into main. A hotfix branch fixes main fast, and is merged into both.

Git Flow suits software shipped as numbered versions, such as an app where version 3 and version 4 are both still in use. In 2020 its author added a note to the post. Teams that ship a website many times a day, it says, should use something simpler.

A monorepo is a related choice: one repository that holds many projects. A web app, a phone app and their shared code can sit in one repo, in separate folders. One commit can then change all three at once. The cost is size, so big monorepos need tools that build and test only what changed.

The common mistake is copying a heavy strategy a small team does not need. Five kinds of branch for a team of three means more merging than coding. Start with main plus short feature branches, and add rules only when a real problem shows up.

## Two branching strategies side by side

| Question | Trunk-based development | Git Flow |
| --- | --- | --- |
| Long-lived branches | One: main | Two: main and develop |
| How often work joins | At least once a day | When a feature is done |
| Half-done work | Hidden behind feature flags | Kept on feature branches |
| Suits | Websites shipped often | Apps with numbered versions |

## Which one to pick

1. **Trunk-based development.** When you ship a website or service many times a week, and your tests are good.
2. **Git Flow.** When you ship numbered versions, and must keep fixing old ones people still use.

![Two panels. Trunk-based development, lit up: one main line with many tiny branches that each rejoin it within a day. Git Flow: five lines, main, develop, feature, release and hotfix. Features join develop, a release branch moves develop into main, and a hotfix goes straight from main back into both. A note says fewer, shorter branches mean fewer merge conflicts.](https://learn.benibix.com/diagrams/dev3-git-workflows.svg)

### Example: A team of 4 drops Git Flow

Jack's team of 4 runs a shopping website and uses Git Flow. Each finished feature waits about 2 weeks for the next release branch.

They switch to trunk-based development with feature flags. Changes now reach the site the same day, and the long merge on release day is gone.

**Words in this lesson:** [Branching Strategy](https://learn.benibix.com/term/development/branching-strategy), [Trunk-Based Development](https://learn.benibix.com/term/development/trunk-based-development), [Git Flow](https://learn.benibix.com/term/development/git-flow), [Monorepo](https://learn.benibix.com/term/development/monorepo), [Feature Flag](https://learn.benibix.com/term/development/feature-flag)

> **The one thing to remember.** Trunk-based teams join work every day and hide the unfinished parts. Git Flow keeps work apart until a release.

**Question:** How do trunk-based teams ship code for a feature that is not finished?

**Answer:** They hide it behind a feature flag that keeps it off. The code joins main every day, but a feature flag keeps the feature switched off for users. It appears when the switch is turned on.

---

Source: https://learn.benibix.com/learn/development-version-control/git-branching-strategies
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
