Trunk-based development (TBD): mọi developer commit thẳng vào main (hoặc PR ngắn hạn < 1 ngày), feature flag để hide work-in-progress khỏi user.
Phù hợp team CI/CD mature, deploy nhiều lần/ngày, test automation tốt. Git Flow (Vincent Driessen, 2010): branch develop riêng, feature/, release/, hotfix/* — quy trình lớn, hợp legacy software có release cycle dài (3-6 tháng), versioned product. Tại sao TBD thắng cho web modern:
- Continuous delivery cần main luôn deployable — branch dài hạn rất dễ drift, merge nightmare;
- feature flag cho phép merge code chưa hoàn chỉnh (ẩn sau flag) — không cần long-running feature branch;
- review nhanh vì PR nhỏ (< 400 lines);
- integration sớm phát hiện conflict trước khi tốn kém. Khi vẫn nên dùng Git Flow: phần mềm phát hành phiên bản (mobile app phải qua App Store review, desktop software, library với semver strict, embedded firmware). Practice TBD: short-lived branch (vài giờ tới 1 ngày), PR < 400 lines, CI gate strict (lint + types + tests + build, không skip), feature flag cho mọi tính năng lớn, monitor production aggressive (alerts, error tracking) vì deploy thường xuyên
Trunk-based development (TBD): every developer commits directly to main (or short-lived PRs <1 day), with feature flags hiding work-in-progress from users.
Suits CI/CD-mature teams that deploy many times a day with strong test automation. Git Flow (Vincent Driessen, 2010): separate develop, feature/, release/, hotfix/* branches — a heavier process, fits legacy software with long release cycles (3-6 months) and versioned products. Why TBD wins for modern web:
- Continuous delivery requires main to always be deployable — long-lived branches drift easily and create merge nightmares;
- feature flags allow merging incomplete code (hidden behind a flag) — no need for long-running feature branches;
- faster reviews because PRs stay small (<400 lines);
- early integration catches conflicts before they become expensive. When Git Flow still fits: versioned releases (a mobile app subject to App Store review, desktop software, libraries with strict semver, embedded firmware). Practicing TBD: short-lived branches (a few hours to one day), PRs <400 lines, strict CI gates (lint + types + tests + build, no skips), feature flags for every major feature, aggressive production monitoring (alerts, error tracking) because you deploy often