Every team argues about Git workflow. Trunk-based vs. GitFlow vs. GitHub Flow vs. whatever the latest thought leader is promoting. The arguments miss the point: the best workflow is the one that fits your team, your deployment cadence, and your risk tolerance.
The Spectrum
Git workflows exist on a spectrum from “move fast” to “control everything.”
Neither end is wrong. They optimize for different things.
Trunk-Based Development
Everyone commits to main. Features ship behind flags. Branches live hours, not days.
The workflow:
| |
Key practices:
Branch lifetime < 1 day Long branches accumulate merge conflicts and integration risk.
Feature flags for incomplete work
1 2 3if feature_flags.is_enabled("new_checkout"): return new_checkout_flow() return old_checkout_flow()CI runs on every commit If tests pass, it’s deployable.
Small, focused commits Each commit should be reviewable in minutes, not hours.
Who it’s for:
- Teams with strong CI/CD
- Web applications with continuous deployment
- Teams comfortable with feature flags
- Organizations prioritizing speed
GitHub Flow
Simplified branching: main is always deployable, features branch off and merge back.
The workflow:
| |
Branch naming conventions:
Who it’s for:
- Most web teams
- Projects with single production version
- Teams wanting simplicity
- GitHub-centric workflows
GitFlow
Structured branching for projects with formal releases.
The branches:
| Branch | Purpose | Merges to |
|---|---|---|
main | Production releases | - |
develop | Integration | main (via release) |
feature/* | New work | develop |
release/* | Release prep | main and develop |
hotfix/* | Production fixes | main and develop |
Creating a release:
| |
Who it’s for:
- Packaged software with versions
- Mobile apps with app store releases
- Projects needing to support multiple versions
- Teams with dedicated release management
Ship/Show/Ask
A social workflow that categorizes changes by risk.
Ship (no review needed):
- Typo fixes
- Dependency updates
- Small refactors you’re confident about
| |
Show (merge, then review):
- Low-risk changes you want feedback on
- Learning opportunities for the team
| |
Ask (review before merge):
- High-risk changes
- Unfamiliar territory
- Security-sensitive code
| |
Who it’s for:
- High-trust teams
- Teams wanting to reduce review bottlenecks
- Organizations with strong testing culture
Practical Patterns
The Perfect Commit Message
Example:
Types:
feat: New featurefix: Bug fixdocs: Documentationrefactor: Code restructuringtest: Test changeschore: Maintenance
Squash vs. Merge vs. Rebase
Squash merge (recommended for most):
| |
- Clean main history
- Loses individual commit detail
- Good for feature branches
Merge commit:
| |
- Preserves complete history
- Creates merge commit
- Good for long-running branches
Rebase:
| |
- Linear history
- Rewrites commits
- Requires force push
Handling Merge Conflicts
Prevention is better than resolution:
Pull often
1 2 3 4 5 6# Before starting work git checkout main && git pull # While working git fetch origin git rebase origin/main # or mergeKeep branches short Shorter branches = fewer conflicts
Communicate “I’m touching the auth module today” prevents duplicate work
When conflicts happen:
| |
Protecting Main
Branch protection rules (GitHub/GitLab):
| |
Minimum settings:
- Require PR (no direct pushes)
- Require CI pass
- Require at least one approval
The Monorepo Question
Monorepos change workflow considerations:
Challenges:
- CI needs to know what changed
- Not every change affects every app
- Large diffs become unmanageable
Solutions:
| |
Choosing Your Workflow
Use Trunk-Based when:
- You deploy continuously
- You have strong CI/CD
- You’re comfortable with feature flags
- Team is experienced and high-trust
Use GitHub Flow when:
- You want simplicity
- You deploy frequently but not continuously
- You have a single production version
- Team is growing or mixed experience
Use GitFlow when:
- You have formal release cycles
- You support multiple versions
- You have dedicated release management
- Regulatory requirements demand traceability
Use Ship/Show/Ask when:
- You trust your team completely
- Review bottlenecks are slowing you down
- You have excellent test coverage
- You want to foster autonomy
The Meta-Rule
Whatever workflow you choose:
- Write it down - Document your workflow in CONTRIBUTING.md
- Automate enforcement - Use CI checks and branch protection
- Review periodically - Workflows should evolve with your team
- Stay consistent - Inconsistent workflow is worse than imperfect workflow
The best Git workflow is one your whole team understands and follows. Everything else is details.
Git is a tool. Workflows are how you use tools together. Pick one and stick with it.