You know how to create branches and make commits. But when you joinWhat is join?A SQL operation that combines rows from two or more tables based on a shared column, letting you query related data in one request. a real team, you discover that knowing Git commands is only half the battle. The other half is agreeing on how to use them together. Without shared conventions, every developer does their own thing, and the repositoryWhat is repository?A project folder tracked by Git that stores your files along with the complete history of every change, inside a hidden .git directory. becomes a mess.
Think of a Git workflow like traffic laws. Every driver knows how to steer and brake, but without rules about which side of the road to drive on, intersections become chaos. A workflow is your team's traffic code for version control.
Why your team needs a workflow
Without a shared workflow, these problems surface within days:
| Problem | What happens | Real cost |
|---|---|---|
| No code review | Bugs ship to production unchecked | Outages, angry users |
| Everyone on main | Constant merge conflicts | Hours lost resolving them |
| No branch naming | Nobody knows who works on what | Duplicated effort |
| No release process | "Is this deployed?" becomes a daily question | Confusion, missed deadlines |
| No hotfix strategy | Emergency fixes take hours instead of minutes | Revenue loss during downtime |
A good workflow solves all of these by establishing clear rules: where to branch from, how to name branches, when to merge, and who reviews the code before it reaches production.
The three main workflows
There are three dominant Git workflows used in the industry today. Each fits a different team size and release cadence.
GitHub Flow
The simplest workflow. You have one permanent branch (main) and create short-lived feature branches for every change.
# 1. Create a feature branch from main
git checkout main
git pull
git checkout -b feature/add-search
# 2. Work on your feature, commit often
git add src/search.js
git commit -m "feat: add search input component"
# 3. Push and open a pull request
git push -u origin feature/add-search
# Open PR on GitHub for code review
# 4. After approval, merge into main
# (Usually done via the GitHub UI)
# 5. Delete the feature branch
git branch -d feature/add-searchGitHub Flow works best for teams that deploy continuously. There is no separate "release" step because every merge to main is a potential deployment.
Git Flow
A more structured workflow designed for teams with scheduled releases. It uses five branch types:
main ─────────────────────────────────── (production)
\ /
develop ──────────────────────────── (integration)
\ \ /
feature/x feature/y (merged to develop)
\
release/1.2 ──────── (testing)
\
main ────────────────────────────── (tagged v1.2)
\
hotfix/critical ──────────────────── (emergency)| Branch type | Created from | Merges into | Purpose |
|---|---|---|---|
main | , | , | Production-ready code only |
develop | main | main (via release) | Integration branch for features |
feature/* | develop | develop | Individual features |
release/* | develop | main + develop | Release preparation and testing |
hotfix/* | main | main + develop | Emergency production fixes |
Git Flow adds complexity but gives you clear separation between development, testing, and production code.
Trunk-Based DevelopmentWhat is trunk-based development?A workflow where all developers commit frequently to a single shared branch, relying on feature flags to hide incomplete work.
The most aggressive workflow. Everyone commits to main (the "trunk") frequently, using feature flags to hide unfinished work.
# Work directly on main with small commits
git checkout main
git pull
# Add feature behind a flag
git add src/search.js
git commit -m "feat: add search (behind feature flag)"
git push
# The feature flag controls visibility
if (featureFlags.search) {
renderSearchBar();
}This works for teams with strong automated testing and continuous deployment pipelines. Without those safeguards, it is risky because broken code goes straight to main.
Choosing the right workflow
| Factor | GitHub Flow | Git Flow | Trunk-Based |
|---|---|---|---|
| Team size | 1-10 | 5-50+ | Any (with CI/CD) |
| Release cadence | Continuous | Scheduled | Continuous |
| Complexity | Low | High | Low (but needs CI/CD) |
| Code review | PR-based | PR-based | PR or pair programming |
| Best for | SaaS, web apps | Mobile, desktop, versioned | High-velocity teams |
Most teams start with GitHub Flow because it is simple and effective. Only switch to Git Flow if you genuinely need scheduled releases with separate testing phases.
Quick reference
| Workflow | Branches | Merge strategy | Best fit |
|---|---|---|---|
| GitHub Flow | main + feature branches | PR merge to main | Small teams, continuous deploy |
| Git Flow | main, develop, feature, release, hotfix | Structured merges through branches | Scheduled releases, large teams |
| Trunk-Based | main only | Direct commits with feature flags | CI/CD-heavy teams |