Branching strategies

ExplainedPracticesDevOps, Hands OnBy Cloud Hands On

Trunk-based development, GitHub flow and GitFlow, and when each fits.

A branching strategy is how a team uses branches to get changes into production. The trend is towards short-lived branches merged into main at least daily, because long-lived branches make painful merges and slow releases.

Feature flags make this possible: unfinished work can be merged switched off.

Cost. Free: it's a team agreement, enforced with branch rules.

Use it when

How it works

Trunk-based
Everyone merges small changes into main daily; releases come from main.
GitHub flow
Branch from main, open a pull request, review, merge, deploy.
GitFlow
Long-lived develop and release branches; suits boxed software with versions, rarely web services.

Options

Trunk-based or GitHub flow
For services deployed continuously.
Release branches
Only when you must support several versions at once.

Example. SS Kaiser moved from GitFlow to GitHub flow with feature flags: merges went from weekly battles to several small PRs a day.

Don't confuse it with

Feature flags
Hide unfinished work in main instead of keeping it on a branch.
Environment branches
A branch per environment drifts; promote the same build instead.

Words to know

Trunk
Another name for main.
Long-lived branch
A branch kept open for weeks; it drifts from main.

Where to look

  1. Repository rules
  2. Pull requests
  3. Feature flags

Practise it

Read it in the guide, next to the tasks and labs.

Open in DevOps, Hands On

Keep going