🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Web & Software Development › Git Version Control for Web & Software Development › Lesson 9
TEC-WEB46-05 · Lesson 9 · 12 clock hours · theory

Branching Strategies: Git Flow and Trunk-Based Development

Objective. Students compare Git Flow and trunk-based development branching strategies, identify the branch naming conventions and rules for each, and select an appropriate strategy given a described project scenario.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

What Is a Branching Strategy?

When a team uses Git, every developer works with a shared history of commits. Without agreed-upon rules for how to create, name, and merge branches, that history quickly becomes impossible to read or trust. A branching strategy is a set of conventions that defines which branches exist, what each one is for, and how code moves from one branch to another.

Two strategies dominate professional practice today: Git Flow, introduced by Vincent Driessen in 2010, and Trunk-Based Development (TBD), favored by teams practicing continuous integration and continuous delivery (CI/CD). Neither is universally superior; the right choice depends on team size, release cadence, and product maturity.

---

Git Flow

Git Flow defines a small set of long-lived branches and supporting short-lived branches with strict rules about what may merge into what.

Long-Lived Branches

Short-Lived Supporting Branches

Merge Rules Summary

| Branch type | Created from | Merges into |

|---|---|---|

| feature/* | develop | develop |

| release/* | develop | main AND develop |

| hotfix/* | main | main AND develop |

When Git Flow Fits

Git Flow suits projects with scheduled, versioned releases — for example, a packaged software product shipped quarterly, a large e-commerce platform with a formal QA cycle, or any team that must maintain multiple versions in production simultaneously. The release branch gives the team a staging area to harden a version without blocking new feature work on `develop`.

Caution

Git Flow adds overhead. Long-running branches accumulate divergence, making merges harder and increasing merge conflict risk. Driessen himself added a note to his original post acknowledging that teams doing continuous delivery may find Git Flow unnecessarily complex.

---

Trunk-Based Development

In Trunk-Based Development, all developers integrate their work into a single shared branch — the trunk, usually called `main` — as frequently as possible, ideally at least once per day.

Core Rules

When Trunk-Based Development Fits

TBD excels when a team deploys frequently — sometimes many times per day. Small startups doing continuous deployment, teams with mature automated test suites, and experienced developers who commit small, focused changes benefit most. It reduces the pain of integration by making integration continuous rather than a big-bang event.

Trade-offs

TBD demands discipline and tooling: thorough automated tests must run before every merge so broken code never stays in main for long. It is harder to adopt on teams with junior contributors or on products where releases must be certified well in advance.

---

Comparing the Two Strategies

| Dimension | Git Flow | Trunk-Based Development |

|---|---|---|

| Permanent branches | main, develop | main only |

| Feature branch lifetime | Days to weeks | Hours to 1–2 days |

| Release process | Dedicated release branch | Tag on main; feature flags |

| Hotfix approach | hotfix/* branch from main | Direct fix to main, fast deploy |

| Best for | Scheduled, versioned releases | Continuous delivery, frequent deploys |

| Merge conflict risk | Higher (long-lived branches) | Lower (frequent integration) |

---

Choosing the Right Strategy

Ask these questions when evaluating a project:

1. How often do you release? Daily or more → lean toward TBD. Monthly or quarterly → Git Flow is a stronger fit.

2. How many versions must you support simultaneously? More than one active release → Git Flow's release branches help isolate maintenance.

3. What is your test automation coverage? Low coverage makes TBD risky; the fast merge pace can push untested code to main.

4. How large and distributed is the team? Larger teams benefit from the explicit structure of Git Flow; small, co-located teams often move faster with TBD.

---

A Note on Safety and Good Practice

Version control itself is a form of technical safety. Protecting the `main` branch with branch protection rules — requiring pull request reviews and passing automated tests before any merge — prevents accidental deletion of production history and ensures a working codebase is always available. Treat `main` as a protected asset, just as you would protect critical infrastructure in any trade.

Key terms9

Git FlowA branching strategy defined by Vincent Driessen that uses two permanent branches (main and develop) plus short-lived feature, release, and hotfix branches with strict merge rules.
Trunk-Based Development (TBD)A branching strategy in which all developers integrate code into a single shared branch (the trunk or main) very frequently, minimizing long-lived feature branches.
develop branchIn Git Flow, the integration branch where completed feature branches are merged and code accumulates until a release is prepared.
feature branchA short-lived branch created to isolate work on a single feature or task; in Git Flow it branches from develop and merges back into develop.
release branchIn Git Flow, a branch forked from develop to stabilize a version for release; only bug fixes are added, and it merges into both main and develop when complete.
hotfix branchIn Git Flow, a branch created directly from main to patch a critical production defect; merges into both main and develop when finished.
feature flag (feature toggle)A configuration switch in code that enables or disables a feature at runtime, allowing incomplete code to exist in main without being visible to users.
merge conflictA situation that occurs when two branches have made different changes to the same part of a file and Git cannot automatically combine them.
branch protection ruleA repository setting that prevents direct pushes to a specified branch and may require passing tests and pull request reviews before merging.
In class: Read the original Git Flow blog post by Vincent Driessen (nvie.com/posts/a-successful-git-branching-model) and a counterpoint article on trunk-based development (trunkbaseddevelopment.com); complete a two-column comparison chart listing the main branches, merge rules, release process, and ideal project type for each. · Instructor presents three project scenarios (a large e-commerce platform with scheduled releases, a small startup doing continuous deployment, a solo developer on a personal project) and students work in groups to argue which strategy fits each scenario best, presenting their reasoning to the class. · Students sketch a branch diagram on paper for a hypothetical four-week feature release using Git Flow, labeling main, develop, feature, release, and hotfix branches with arrows showing merge direction; diagrams are peer-reviewed for accuracy.
Materials: Printed or on-screen articles, comparison chart worksheet, whiteboard, markers, blank paper for diagrams
Check: Comparison chart is complete and accurate; branch diagram contains all required branch types with correct merge directions; student earns 80% on a 10-question scenario-matching quiz.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Core IT concepts / software development practices
1. In Git Flow, which branch should a developer create a hotfix branch from?
Core IT concepts / software development practices
2. A software team ships a new version of their product every three months and must maintain the previous version for enterprise customers. Which branching strategy is the better fit?
Core IT concepts / software development practices
3. In Trunk-Based Development, what technique allows a developer to merge incomplete feature code into main without exposing it to end users?
Core IT concepts / software development practices
4. According to Git Flow merge rules, when a release branch is finished, it must be merged into which branches?
Core IT concepts / software development practices
5. Which factor most strongly favors choosing Trunk-Based Development over Git Flow?
Core IT concepts / software development practices
6. A developer names a branch work/new-checkout-page. Which Git Flow naming convention does this violate?
Core IT concepts / software development practices
7. A small startup with two developers wants to deploy updates several times a week and has a solid suite of automated tests. Which branching strategy is most appropriate, and why?
Core IT concepts / software development practices
8. What is the primary purpose of a branch protection rule on the main branch?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.