← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

GitFlow vs Trunk-Based Development

devops Intermediate
debt(d7/e7/b7/t7)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The detection_hints confirm automated=no, and the tools listed (git, github, gitlab) don't flag branching strategy misuse automatically. Misuse only becomes visible through painful merge events, slow release cycles, or team friction — identified via code review of branch patterns or retrospectives, not tooling.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7). The quick_fix confirms the remedy is a wholesale strategy change — moving from GitFlow to trunk-based development with feature flags. This requires retraining the team, restructuring CI/CD pipelines, changing branch protection rules, updating documentation, and shifting cultural norms around how work is integrated. It touches every developer's daily workflow and the entire delivery pipeline.

b7 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (b7). applies_to is 'any' context, meaning once a team adopts GitFlow the branching model shapes every feature, hotfix, and release workflow. Common mistakes include long-lived diverging branches and merge ceremonies that slow all work streams. The branching model imposes a persistent productivity tax across all team members and CI/CD configuration — every change is shaped by this choice.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap (contradicts how a similar concept works elsewhere)' (t7). The misconception field explicitly states 'GitFlow is the standard that all teams should use' — a widely held belief that leads teams deploying continuously to adopt a model that actively works against them. The trap is that GitFlow is widely promoted as best practice, so a competent developer encountering it assumes it's universally appropriate, when in fact it's only suited to scheduled-release, multi-version products.

About DEBT scoring →

Also Known As

GitFlow git flow branching feature develop main branches

TL;DR

GitFlow uses long-lived feature and release branches; trunk-based development merges to main frequently — the latter scales better with CI/CD.

Explanation

GitFlow (Vincent Driessen, 2010) defines long-lived branches: main (production), develop (integration), feature/* (short-lived), release/* (stabilisation), hotfix/*. It works well for software with scheduled versioned releases (libraries, apps with manual deployment). Trunk-Based Development (TBD) has developers commit directly to main (or via short-lived branches merged within a day). TBD requires: feature flags to hide incomplete work, comprehensive CI that runs in minutes, and high test coverage. TBD scales better with continuous deployment — GitFlow's long-lived branches accumulate merge conflicts and slow integration feedback. Most modern web applications (including PHP SaaS products) benefit from TBD. GitFlow remains appropriate for open-source libraries and versioned products.

Diagram

flowchart LR
    subgraph GitFlow
        MAIN[main] --- HOT[hotfix]
        MAIN --- REL[release/1.0]
        DEV[develop] --- FEAT1[feature/A]
        DEV --- FEAT2[feature/B]
        REL -->|merge| MAIN
        REL -->|merge back| DEV
    end
    subgraph Trunk-Based
        TRUNK[main / trunk]
        TRUNK --- SHORT1[short-lived<br/>branch < 1 day]
        TRUNK --- SHORT2[short-lived<br/>branch < 1 day]
        SHORT1 & SHORT2 -->|merge fast| TRUNK
        FF[Feature Flags<br/>for incomplete work] -.-> TRUNK
    end
style MAIN fill:#238636,color:#fff
style DEV fill:#1f6feb,color:#fff
style SHORT1 fill:#d29922,color:#fff
style SHORT2 fill:#d29922,color:#fff

Common Misconception

GitFlow is the standard that all teams should use. GitFlow suits release-based products with scheduled releases and long-term version support. Teams deploying multiple times a day find GitFlow adds overhead without benefit — trunk-based development better suits continuous deployment.

Why It Matters

Gitflow defines a branching model with explicit roles for feature, release, and hotfix branches — it prevents untested code from reaching production and enables parallel work without conflicts.

Common Mistakes

  • Long-lived feature branches that diverge massively from main — merges become painful integration events.
  • Forgetting to merge hotfixes back into develop — the fix disappears on the next release.
  • Using Gitflow for continuous deployment — the release branch ceremony is too slow for multiple deploys per day.
  • Not tagging releases — losing the ability to identify exactly what code was deployed at any point.

Code Examples

✗ Vulnerable
# Gitflow anti-pattern — hotfix not merged back:
git checkout -b hotfix/critical-bug main
# Fix and deploy to production
git checkout main && git merge hotfix/critical-bug
# Missing: git checkout develop && git merge hotfix/critical-bug
# Bug returns in next release from develop
✓ Fixed
# Gitflow — branch strategy for release-based projects

# Permanent branches:
# main      — production-ready at all times
# develop   — integration branch for features

# Temporary branches:
# feature/TICKET-123-add-mfa        — from develop, merge to develop
# release/2.5.0                     — from develop, merge to main + develop
# hotfix/CVE-2024-critical-patch    — from main, merge to main + develop

# Workflow:
$ git checkout -b feature/TICKET-456-password-reset develop
# ... work ...
$ git checkout develop && git merge --no-ff feature/TICKET-456-password-reset

# For most web apps, prefer trunk-based development:
# Single main branch + short-lived feature branches + feature flags
# Simpler, faster CI/CD, less merge conflict pain
# Use Gitflow only if you need to support multiple release versions

Added 15 Mar 2026
Edited 22 Mar 2026
Views 32
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
2 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 1 ping T 2 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 1 ping T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 2 pings F 0 pings S
No pings yet today
Perplexity 1 Amazonbot 1
Perplexity 10 Amazonbot 10 Ahrefs 2 Majestic 1 Google 1 ChatGPT 1
crawler 25
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Medium
⚡ Quick Fix
Only use Gitflow if you maintain multiple supported versions simultaneously — for continuous delivery apps, trunk-based development with feature flags is simpler and faster
📦 Applies To
git any
🔗 Prerequisites
🔍 Detection Hints
Long-lived feature branches >1 week; complex merge ceremonies; release branches diverging significantly from main; teams with continuous deployment using Gitflow unnecessarily
Auto-detectable: ✗ No git github gitlab
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Medium Context: File

✓ schema.org compliant