DEV3 Technologies home

DEV3 Developer Forum

Which Git branching strategy works best for a small team?

General IT0 views
dev3 ·

We are four developers and keep arguing about Git flow versus trunk-based development. Which branching strategy suits a small team shipping a web app?

#git#workflow#branching

0

1 reply

dev3 ·

Short answer: most small teams do well with a simple trunk-based style: one main branch that is always deployable, short-lived feature branches and pull requests. Heavier models only pay off with scheduled releases and multiple supported versions.

Option 1: trunk-based with short-lived branches

  • main is always releasable.
  • Create a branch per task, keep it small and merge within a day or two.
  • Use pull requests with CI checks and a review.
  • Hide unfinished work behind feature flags instead of long branches.
  • Deploy from main, tag releases.

Option 2: Git flow

  • Long-lived develop and main branches, plus release and hotfix branches.
  • Suits software with versioned releases and several supported versions at once.
  • Costs more merging effort and ceremony.

Option 3: GitHub flow

Essentially option 1: branch from main, open a pull request, merge, deploy.

What matters more than the model

  • Small, frequent merges. Long-lived branches cause painful conflicts.
  • Automated tests in CI so main stays healthy.
  • Protected main: no direct pushes, required checks.
  • Clear naming: feature/short-description, fix/short-description.
  • Squash or rebase conventions agreed by the team.

Example flow

git switch main && git pull
git switch -c fix/invoice-rounding
# commit changes
git push -u origin fix/invoice-rounding
# open a pull request, review, merge, delete the branch

Pitfalls

  • Branches that live for weeks.
  • A develop branch nobody trusts.
  • Hotfixes applied to production but never merged back.

Choose the lightest model that matches how you release, write it down in one page and revisit it if releases change.

0

Your reply

Every post is reviewed by DEV3 before it appears. Usually reviewed within 24 hours.

Markdown supported. Use ``` for code blocks. Images are not allowed.