How to Set Up a Git Branching Strategy for Small Teams: GitFlow vs Trunk-Based Development

If you work in a small dev team (2 to 10 people), your git branching strategy can either accelerate delivery or become a daily bottleneck. Too much process kills momentum. Too little creates chaos on main. This guide compares GitFlow and trunk-based development, gives you concrete naming conventions, merge workflows, and real command examples so you can pick what fits your release cadence without overengineering.

Why Your Branching Strategy Matters (Even in a 3-Person Team)

A branching strategy is a shared contract. It defines where code lives, how it gets reviewed, and when it ships. Small teams often skip this conversation and end up with:

  • Long-lived feature branches that drift from main
  • Painful merge conflicts on Friday afternoons
  • Unclear release process (“what’s actually in production?”)
  • Hotfixes applied directly to production with no traceability

Pick a strategy early, document it in your CONTRIBUTING.md, and revisit it every 6 months.

git branches diagram

The Two Realistic Options for Small Teams

Forget the 6-branch diagrams you saw on LinkedIn. For a small team, it comes down to two workable models:

1. GitFlow (structured, release-oriented)

Introduced by Vincent Driessen, GitFlow uses multiple long-lived branches:

  • main reflects production
  • develop is the integration branch
  • feature/* branches off develop
  • release/* stabilizes a version before shipping
  • hotfix/* patches production directly

Best when: you ship on a fixed schedule (weekly, monthly), you support multiple versions in production, or you have QA gates.

2. Trunk-Based Development (fast, continuous)

Everyone commits to main (the trunk) via short-lived branches that live less than 2 days. Feature flags hide unfinished work. Releases are cut from main as tags. There’s a good explainer over at dev.to.

Best when: you deploy multiple times per week or per day, you have solid CI, and you trust your test suite.

Side-by-Side Comparison

Criteria GitFlow Trunk-Based
Release cadence Scheduled (weekly/monthly) Continuous (daily+)
Branch lifespan Days to weeks Hours to 2 days max
Merge conflicts Frequent, larger Rare, small
CI/CD required Nice to have Mandatory
Feature flags Optional Highly recommended
Learning curve Higher Lower
Fits SaaS web apps Overkill Ideal
Fits mobile / desktop / embedded Ideal Possible with tags

Branch Naming Conventions That Actually Scale

Whichever strategy you pick, enforce a naming convention. It makes filtering, automation, and code review much easier.

Recommended pattern

<type>/<ticket-id>-<short-description>

  • feature/PROJ-142-add-oauth-login
  • bugfix/PROJ-198-fix-null-user-avatar
  • hotfix/PROJ-210-stripe-webhook-500
  • chore/upgrade-node-22
  • refactor/extract-payment-service

Rules

  1. Lowercase only, dashes as separators
  2. Always prefix with the branch type
  3. Include the ticket ID (Jira, Linear, GitHub Issues) for traceability
  4. Keep it under 50 characters
  5. Delete the branch after merge (enable auto-delete in GitHub/GitLab)
git branches diagram

GitFlow in Practice: Real Commands

Starting a feature

git checkout develop
git pull origin develop
git checkout -b feature/PROJ-142-add-oauth-login
# work, commit, push
git push -u origin feature/PROJ-142-add-oauth-login

Opening the PR and merging

Open a Pull Request from feature/PROJ-142-add-oauth-login into develop. After review and green CI:

git checkout develop
git pull origin develop
git merge --no-ff feature/PROJ-142-add-oauth-login
git push origin develop
git branch -d feature/PROJ-142-add-oauth-login

Cutting a release

git checkout develop
git checkout -b release/1.4.0
# bump version, update changelog, fix last minute bugs
git checkout main
git merge --no-ff release/1.4.0
git tag -a v1.4.0 -m "Release 1.4.0"
git push origin main --tags
git checkout develop
git merge --no-ff release/1.4.0
git push origin develop

Emergency hotfix

git checkout main
git checkout -b hotfix/PROJ-210-stripe-webhook-500
# fix, commit
git checkout main
git merge --no-ff hotfix/PROJ-210-stripe-webhook-500
git tag -a v1.4.1 -m "Hotfix 1.4.1"
git push origin main --tags
git checkout develop
git merge --no-ff hotfix/PROJ-210-stripe-webhook-500
git push origin develop

Trunk-Based Development in Practice

The core loop

  1. Pull latest main
  2. Create a short-lived branch
  3. Commit small and often
  4. Open a PR the same day
  5. Merge (squash) into main after review and CI
  6. Delete the branch

Commands

git checkout main
git pull --rebase origin main
git checkout -b feature/PROJ-142-oauth
# small commits
git push -u origin feature/PROJ-142-oauth
# open PR, get review, CI green
# merge via GitHub "Squash and merge"
git checkout main
git pull --rebase origin main

Releasing

Tag any commit on main that passes production checks:

git checkout main
git pull
git tag -a v2026.07.28 -m "Production release"
git push origin --tags

Feature flags: your safety net

Merge unfinished code behind a flag so main stays deployable: There’s a fuller breakdown if you want the detail.

if (featureFlags.isEnabled("new-checkout")) {
  renderNewCheckout();
} else {
  renderLegacyCheckout();
}

Tools like Unleash, LaunchDarkly, or a simple env-based flag work perfectly.

How to Choose: A Decision Framework

Ask yourself these five questions:

  1. How often do we deploy? More than 2x/week means trunk-based.
  2. Do we maintain multiple versions in production? Yes means GitFlow.
  3. Is our CI reliable (tests, linting, security scan)? No means GitFlow until you fix CI.
  4. Do we have manual QA before release? Yes suggests GitFlow release branches.
  5. Are we shipping a SaaS web app? Trunk-based is almost always the answer.
git branches diagram

Our Recommendation for Most Small Teams in 2026

For the majority of small teams building web applications or internal tools, we recommend a simplified trunk-based approach, often called GitHub Flow: You can read more here.

  • One long-lived branch: main
  • Short-lived feature/* and bugfix/* branches (max 2 days)
  • Mandatory PR with at least 1 reviewer
  • Squash-and-merge to keep history clean
  • Protected main: no direct push, CI must pass
  • Tag releases with semantic versioning

If you build embedded software, mobile apps sold through app stores, or products with long-term support versions, stick with GitFlow.

Common Mistakes to Avoid

  • Long-lived feature branches. If a branch lives more than 3 days, split the work.
  • No branch protection. Always require PR reviews and passing CI on main.
  • Merging without rebasing. Keep history linear when possible (squash or rebase).
  • Skipping tags. Tags are how you answer “what’s in production right now?”
  • Copying enterprise workflows. Your team is not Google. Simpler is better.

FAQ

Is GitFlow dead in 2026?

No. Vincent Driessen himself noted GitFlow is not ideal for web SaaS but remains valuable for versioned software (mobile apps, libraries, embedded systems). It’s not dead, just misapplied.

Can a 2-person team use trunk-based development?

Absolutely. In fact, trunk-based works even better with fewer people because coordination overhead is minimal. Just protect main and require CI to pass. For a real-world example, look at another team working this way.

Should we squash, rebase, or merge commits?

For small teams, squash and merge gives the cleanest history: one commit per feature on main. Use rebase locally to keep your branch up to date before opening the PR.

How do we handle multiple environments (dev, staging, prod)?

Don’t map environments to branches. Deploy the same commit from main to each environment through your CI/CD pipeline. Use environment variables and feature flags to differentiate behavior.

What if our team doesn’t have CI yet?

Set up CI before adopting trunk-based. A minimal GitHub Actions or GitLab CI pipeline with tests and linting takes 1 to 2 hours to configure and pays off within a week.

How do we onboard new developers to our branching strategy?

Document it in CONTRIBUTING.md at the root of the repo. Include the naming convention, the PR checklist, and the 3 most common commands. Pair new devs on their first PR.

Wrapping Up

Your git branching strategy for small teams should serve delivery, not the other way around. Start simple with trunk-based or GitHub Flow, add structure only when a real problem appears. Document your workflow, protect main, and keep branches short-lived. That’s 90% of what actually matters.

Need help auditing your current git workflow or setting up CI/CD for your team? Get in touch with the Coding4 team and we’ll help you streamline it.

Leave a Comment

Your email address will not be published. Required fields are marked *