Branching Strategies
Why Branching Strategy Matters for QA
The branching strategy your team uses determines how you manage test branches, when you run which tests, and how releases map to test results. Understanding the strategy is not optional -- it directly shapes your test execution plan.
The Three Main Strategies
| Aspect | GitFlow | GitHub Flow | Trunk-Based Development |
|---|---|---|---|
| Main branches | main + develop |
main only |
main only |
| Feature branches | Branch from develop, merge back to develop |
Branch from main, merge via PR |
Short-lived branches (< 1 day), merge to main |
| Release process | release/* branch for stabilization |
Deploy from main after merge |
Deploy from main continuously |
| Hotfixes | hotfix/* branch from main |
Branch from main, merge via PR |
Fix on main directly |
| Complexity | High -- multiple long-lived branches | Low -- one main branch | Low -- but requires mature CI/CD |
| Best for | Scheduled releases, multiple versions in production | SaaS with continuous deployment | Teams with strong test automation and feature flags |
GitFlow in Detail
GitFlow uses two long-lived branches (main and develop) plus short-lived branches for features, releases, and hotfixes.
main ──────────────●───────────────────●──────── (production releases)
↑ ↑
release/2.3 ──────● release/2.4 ────●
↑ ↑
develop ───●──●──●─┘──●──●──●──●──●───┘──●──── (integration branch)
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
feature branches (short-lived)
QA Implications for GitFlow
- Test on
develop: Every feature merged todevelopshould trigger regression tests - Test again on
release/*: The release branch is for stabilization. Only bug fixes go here, and each fix needs testing - Double testing burden: You may test a feature on
developand then test the same feature again on the release branch - Hotfix testing: Hotfixes branch from
main, get tested, merge to bothmainanddevelop - Environment mapping:
developmaps to a dev/integration environment,release/*maps to staging,mainmaps to production
When to advocate for GitFlow:
- Your product has scheduled releases (quarterly, monthly)
- Multiple versions are supported simultaneously (v2.3 and v2.4 both in production)
- Regulatory requirements demand a stabilization phase before release
GitHub Flow in Detail
GitHub Flow uses a single main branch. All work happens on feature branches that merge via pull requests.
main ──────●──●──●──●──●──●──●──●──●──── (always deployable)
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
PRs from feature branches
QA Implications for GitHub Flow
- Test on PR: Every pull request triggers the full test suite. This is your primary quality gate.
- Main is always deployable: If tests pass on the PR and the PR is merged,
mainshould be safe to deploy at any time - No stabilization phase: There is no release branch. If something is broken on
main, fix it with another PR. - Simpler environment mapping: Feature branches deploy to preview environments,
maindeploys to production
When to advocate for GitHub Flow:
- Your team does continuous deployment (deploy multiple times per day)
- You have a single version in production
- Your CI pipeline is fast and reliable enough to gate PRs effectively
Trunk-Based Development in Detail
Trunk-based development takes GitHub Flow to its extreme. Feature branches live less than a day. Developers commit to main frequently, often multiple times per day.
main ──●●●●●●●●●●●●●●●●●●●●●● (continuous stream of small commits)
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
Very short-lived branches (hours, not days)
QA Implications for Trunk-Based Development
- Every commit must pass all tests: There is no stabilization period. The pipeline must be fast and reliable.
- Feature flags replace feature branches: Incomplete features are deployed behind flags, not on separate branches
- Testing shifts left dramatically: QA reviews requirements and writes tests before development starts, because there is no time to catch up later
- Flaky tests are existential threats: A flaky test that blocks
mainblocks the entire team. Fix flaky tests immediately.
When trunk-based development works:
- The team has high test automation maturity (>90% of tests automated)
- CI pipeline completes in under 10 minutes
- Feature flags are available and well-managed
- The team has strong code review discipline
Adapting Your Test Plan to the Strategy
| Strategy | When to Run Unit Tests | When to Run Integration Tests | When to Run E2E Tests | When to Run Full Regression |
|---|---|---|---|---|
| GitFlow | On every push | On PR to develop | On PR to develop | On release branch, before merge to main |
| GitHub Flow | On every push | On every PR | On every PR | On merge to main (pre-deploy) |
| Trunk-Based | On every push | On every push or PR | On merge to main | Continuously (every deploy) |
Transitioning Between Strategies
Teams often start with GitFlow and migrate toward GitHub Flow or trunk-based development as their automation matures. If your team is considering a transition, here is what QA needs to prepare:
Moving from GitFlow to GitHub Flow
- Speed up the pipeline: GitHub Flow relies on PR checks as the primary gate. If your pipeline takes 40 minutes, PRs will be painful.
- Eliminate the release branch test phase: All testing must happen on the PR. Any tests that only ran on the release branch must move to the PR pipeline.
- Improve test reliability: In GitFlow, a flaky test on the release branch might be tolerated. In GitHub Flow, a flaky test blocks every PR.
Moving from GitHub Flow to Trunk-Based
- Implement feature flags: You need a way to deploy incomplete features safely.
- Reduce pipeline time to under 10 minutes: Developers cannot wait 20 minutes for every small commit.
- Achieve near-zero flaky test rate: Every test failure on main blocks the team.
- Shift QA earlier: QA must participate in design and requirements, not wait for code.
Hands-On Exercise
- Identify which branching strategy your current team uses.
- Map out when each type of test runs in your workflow. Are there gaps?
- If your team uses GitFlow, identify tests that run twice (on develop and on release). Could you eliminate the duplication?
- If your team uses GitHub Flow, measure your PR pipeline time. Is it under 15 minutes?
- Propose one improvement to your team's test execution plan based on the branching strategy.