Flow
Git Workflows
A workflow defines how your team branches, reviews, and ships code. The right model reduces merge conflicts, speeds up reviews, and makes your release process predictable.
Pick Your Model
Match the workflow to your release cadence and team maturity. Don't over-engineerβstart simple.
Feature Branch
One branch per feature, cut from main. Work in isolation, push when ready, merge after review. The safe default for any team. Works with any release cadence and enforces code review without added process overhead.
git done # sync with latest main first
git cb feature/user-auth # create & switch
git ap && git cm "feat(auth): add OAuth flow"
git publish # push & track β open PR- Branch lives only as long as the feature β delete after merge
mainstays deployable at all times- PR review is built naturally into the flow
- Combine with conventional commits for readable merge history
GitHub Flow
A deployment-first variant of Feature Branch. main is always production-ready. Branch β commit β deploy to staging β review β merge β auto-deploy. Simpler than Gitflow; great for products shipping multiple times per day.
git cb feature/dark-mode
# develop, commit, push
git publish
# β deploy branch to staging β PR review β merge β CI deploys main- No
developbranch βmainis the single integration point - Every PR gets a preview deploy before it touches
main - Requires a reliable CI/CD pipeline to be safe
- Best for SaaS products and APIs with frequent deploys
Gitflow
Two permanent branches: main (production) and develop (integration). Features branch from develop; release branches stabilize before tagging main; hotfixes go straight to main and back to develop.
# feature work β branches off develop
git cb feature/payment develop
git cm "feat(payment): stripe integration"
# β PR to develop when done
# prepare release
git cb release/2.1.0 develop
# bump version, final fixes β merge to main + tag + back-merge to develop
# urgent production fix
git cb hotfix/2.0.1 main
# β merge to main + develop- Use for apps with defined release windows or versioned libraries
- Supports parallel work on multiple releases simultaneously
- More overhead β branches:
feature/*,release/*,hotfix/* - Not ideal for continuous delivery β adds friction on every ship
Trunk-Based Development
Everyone commits to main (trunk) frequently β ideally multiple times per day. Feature branches are optional and short-lived (hours, not weeks). Incomplete work is hidden behind feature flags, not long-lived branches.
# short-lived branch β same-day merge target
git cb feat/quick-change
git cm "feat: add tooltip on hover"
git publish
# β fast review β merge same day β branch deleted
# direct commit with feature flag guard
git cm "feat: scaffold [FF: new-checkout] skeleton"
git ps- Branches live β€ 2 days β anything longer is a code smell here
- Requires fast, reliable automated tests on every commit
- Feature flags manage incomplete work already in production
- Reduces merge conflicts drastically on large teams
At a Glance
| Criteria | Feature Branch | GitHub Flow | Gitflow | Trunk-Based |
|---|---|---|---|---|
| Complexity | Low | Low | High | Medium |
| Release cadence | Any | Continuous | Scheduled | Continuous |
| Long-lived branches | main | main | main + develop | main only |
| Needs CI/CD | Optional | Required | Optional | Required |
| Good for | Most teams | SaaS / web | Versioned apps | Microservices |
Daily Commands
These git-devkit aliases work with any workflow. Adapt branch names to your chosen model.
git done # sync with latest main (fetch + rebase)
git cb feature/name # create & switch to branch
git s # quick status check
git ap # stage intentional hunks, not whole files
git ds # review staged diff before committing
git cm "feat(scope): message" # conventional commit
git lg # inspect local history
git publish # push & set upstream tracking
git cleanup # delete all merged branchesApply It in Your Team
Start with Feature Branch if you're unsure β it's the easiest to adopt and covers 90% of team needs. Layer in the others as your process matures.