Git does not tell a team how to use branches. A workflow is the agreement: which branches exist, where new work starts, how it gets reviewed and how it reaches production. The right choice depends mostly on one question: how often do you deploy? This lesson compares the four workflows you will meet and shows which one fits Orbit.
Trunk-based development
Everyone integrates into one branch, main (the “trunk”), at least once a day. Branches, if used, live for hours, not weeks.
main --o--o--o--o--o--o--o--o--> deploy from main, many times a day
\_/ \_/ \_/
short-lived branches (hours)
- Unfinished features are merged early but hidden behind feature flags, switched on when ready.
mainmust always be deployable, so strong CI is required: every merge runs the full test suite.- Merge conflicts stay tiny because nobody drifts far from
main.
Trunk-based development is what high-performing teams in the DORA research use most, and it is the natural fit for continuous deployment.
GitHub flow
A lightweight, popular version of the same idea, built around pull requests (lesson 11):
mainis always deployable.- Create a descriptively named branch from
main. - Commit and push; open a pull request early.
- Review and CI on the pull request.
- Merge to
mainand deploy right away.
It has one long-lived branch and nothing else. It works best for web services and SaaS products that run one version in production.
GitLab flow: environment branches
Some teams cannot deploy every merge straight to production: there is a staging sign-off, a change window or a regulator. GitLab flow adds environment branches downstream of main:
main ----o----o----o----o---> merged features
\ \
staging -------o---------o---> deployed to staging
\
production -------o---------> deployed to production after approval
Changes always flow one way: merged to main, then promoted to staging, then to production, through merge requests. Fixes go to main first and are promoted or cherry-picked forward, never made directly on production. A popular alternative to environment branches is promoting the same build artifact with tags and deployment approvals in the pipeline.
Git Flow
Git Flow (2010) uses two long-lived branches and three kinds of short-lived ones:
| Branch | Purpose | Merged into |
|---|---|---|
main | Released versions only, each tagged | (nothing) |
develop | Integration of finished features | release/* |
feature/* | One feature, from develop | develop |
release/* | Stabilise a version, only fixes | main and develop |
hotfix/* | Urgent fix to production, from main | main and develop |
It fits software with scheduled, versioned releases: desktop apps, libraries, firmware, products that customers install. For a web service deployed many times a day, it adds overhead and long-lived branches with painful merges. Even its author added a note recommending simpler flows for continuously delivered software.
Release branches for maintained versions
If you support several versions at once, for example Orbit 1.x for enterprise customers while 2.x is current, add release branches to any of the flows above:
$ git switch -c release/1.4 v1.4.0
$ git cherry-pick -x 3e8a1f0 # back-port a security fix from main
$ git tag -a v1.4.1 -m "Orbit 1.4.1"
$ git push origin release/1.4 v1.4.1
Fix on main first, then cherry-pick to each supported release branch (lesson 12). That way no fix is ever lost in the next version.
Comparing the workflows
| Trunk-based | GitHub flow | GitLab flow | Git Flow | |
|---|---|---|---|---|
| Long-lived branches | main | main | main + environments | main + develop |
| Branch lifetime | Hours | Hours to days | Days | Days to weeks |
| Deploy frequency | Many per day | Per merge | Per promotion | Per release |
| Needs feature flags | Yes | Helpful | Helpful | No |
| CI maturity needed | High | Medium to high | Medium | Low to medium |
| Best for | Continuous deployment | Web apps, SaaS | Staged or regulated releases | Versioned, installed software |
Choosing for Orbit
Orbit is a web app with a good test suite and a pipeline that deploys in minutes. The team picks GitHub flow with trunk-based habits:
- Branches from
main, merged within a day or two through pull requests. - Squash merges, so
mainreads as one commit per change. - Feature flags for anything that cannot ship in two days.
- Deploy on every merge to
main; version tags for each production release. - A
release/1.xbranch only while enterprise customers still run 1.x.
Whatever you pick, write it down in CONTRIBUTING.md and enforce it with branch protection. A workflow only works if everyone follows the same one.
Quick reference
| If your team… | Consider |
|---|---|
| Deploys many times a day with strong CI | Trunk-based development |
| Ships a web app through pull requests | GitHub flow |
| Needs staging sign-off before production | GitLab flow or artifact promotion |
| Ships numbered versions customers install | Git Flow or release branches |
| Supports several versions at once | Release branches plus cherry-picks |
Exercise
Orbit deploys to production after every merge to main and has thorough automated tests. Which workflow fits best?
Show answer
Answer: C. With continuous deployment and good tests, short-lived branches merged into an always-deployable main keep integration simple. Git Flow’s extra branches add delay without benefit here.
Exercise
In trunk-based development, a feature needs three weeks of work but branches should live less than a day. How do teams handle that?
Show answer
Answer: D. Feature flags separate deploying code from releasing a feature. Unfinished code ships turned off, so main stays deployable and branches stay short.
Exercise
Your company sells a self-hosted product with versions 3.2 and 4.0 under support. A security bug affects both. Where do you fix it first?
Show answer
Answer: A. Fixing main first guarantees the fix is in every future version. Cherry-picking it to release/3.2 and release/4.0 then produces patch releases for supported customers.
Key takeaways
- A workflow is the team’s agreement on branches, review and release; it should follow how often you deploy.
- Trunk-based development and GitHub flow keep one long-lived branch and short-lived feature branches.
- GitLab flow adds environment branches or promotions for staged releases; changes flow one way.
- Git Flow suits versioned, installed software and is heavy for continuous deployment.
- Release branches plus cherry-picks maintain old versions; document the workflow and enforce it with protection rules.
FAQ
Is Git Flow outdated?
Not for what it was designed for: products with planned, numbered releases. It is a poor fit for web services deployed continuously, which is most of what DevOps teams run today. Use it only if your release process actually needs a develop branch.
What is a feature flag?
A switch, read at runtime from configuration or a flag service, that turns a feature on or off without a deploy. It lets unfinished work be merged and deployed safely, and lets you roll out to a few users first.
Do we need a develop branch?
Only if you need a place where finished features wait for a scheduled release. If every merge to main can be deployed, a develop branch only adds a second merge and a second place for conflicts.
How does GitOps change the workflow?
In GitOps, a repository describes what runs in each environment, and a controller such as Argo CD or Flux applies it. Promotion becomes a pull request that changes an image tag in the environment’s folder or branch, so the Git history is the deployment history.
What should a CONTRIBUTING.md say about the workflow?
Where branches start, how to name them, the commit message format, how to open and size a pull request, the merge method and who approves. Short and specific beats long and vague.