← Back to the Build Your Homepage series
πŸ”€
EPISODE 01
Trunk-based Β· Git Flow Β· feature branches Β· naming

Branching Strategies

Pick a branching strategy that fits team size and release cadence. Compare trunk-based with Git Flow, and adopt sane naming conventions.

GitbranchingGit Flowtrunk-based
Duration
⏱ About 1.5 hours
Level
πŸ“Š Intermediate
Prerequisite
🎯 Lesson 3 (Git CLI)
OUTCOME
A repeatable branching workflow your whole team can follow

What you'll learn

  • 1Compare trunk-based vs Git Flow
  • 2Use short-lived feature branches
  • 3Adopt naming conventions: feature/, bugfix/, hotfix/
  • 4Decide when to use release branches

1. Trunk-based Development

  • main is always deployable
  • Short-lived feature branches (< 1 day) merged via PR
  • Use feature flags for in-progress work
  • Best for small/medium teams shipping daily

2. Git Flow

  • main = production
  • develop = integration of completed features
  • feature/X branches off develop, merges back
  • release/X branches for staging, hotfix/X for emergencies
  • Best for slower release cycles (monthly+)
πŸ’‘

Git Flow is heavy for modern web apps. Most teams use trunk-based + feature flags now.

3. Naming Conventions

PatternExampleWhen
feature/...feature/dark-modeNew work
bugfix/...bugfix/login-redirectFixing an open issue
hotfix/...hotfix/payment-bugEmergency on production
chore/...chore/update-depsMaintenance, no user-facing change
docs/...docs/contributing-guideDocs only

4. Cleaning Up

bash
# Delete merged branches locally
git branch --merged | grep -v '\*\|main' | xargs git branch -d

# Prune deleted remote branches
git fetch --prune
Example code / lecture materials

All lecture materials and example code are openly available on GitHub.

View on GitHub β†—