Home/Engineer/Git / CI·CD/Git Branching Strategy — Git…
Git / CI·CDBeginnerubuntumacoswindowsgitgithubbranch

Git Branching Strategy — GitHub Flow & Git Flow

Compares GitHub Flow, which fits small teams, with Git Flow for teams that have a defined release cycle, and explains how to choose between them.

Contents
  1. Comparing the Two Strategies
  2. GitHub Flow
  3. Git Flow Primary Branches
  4. Conventional Commits
  5. Branch Protection Rules (GitHub)

Comparing the Two Strategies

CriterionGitHub FlowGit Flow
ComplexityLowHigh
Release cadenceContinuous (CD)Scheduled releases
Best forStartups, small teamsApp stores, enterprise

GitHub Flow

Bash
git switch -c feat/user-auth
git add .
git commit -m "feat: JWT User "
git push -u origin feat/user-auth
# → PR → → main →
git branch -d feat/user-auth

Git Flow Primary Branches

BranchRole
mainProduction code, versioned with tags
developIntegration for the next release
feat/*Feature development
release/*QA and bug fixes
hotfix/*Emergency fixes
Bash
git flow init
git flow feature start login
git flow feature finish login
git flow release start 1.2.0
git flow release finish 1.2.0

Conventional Commits

CODE
feat(auth): JWT
fix(api): reply
docs: README
refactor(db):
chore:

Branch Protection Rules (GitHub)

Settings → Branches → Add rule:

  • Require pull request reviews (at least 1 reviewer)
  • Require status checks (CI must pass)
  • Restrict pushes (no direct pushes)
#git#github#branch#gitflow
Editorial note

AI tools may assist drafting. Check the evidence in each guide for whether commands were run and which environment was used. Confirm the current docs for your version before applying instructions, and email us about errors. email us

Topic-related official docs (auto-linked · not per-claim sources)Git documentation ↗

Questions & answers

Ask a question about this guide. We'll review and reply.