This document outlines common Git workflows used in software development teams. Choose the one that best fits your project's size, complexity, and collaboration needs.
1️⃣Centralized Workflow
A simple workflow where all developers push and pull from a single central branch, usually main
.
Best for:
- Small teams or solo projects
- Simple projects without parallel features
Branch Structure
Repo
└── main
└── [all commits here]
Example
# Start working from the main branch
git checkout main
git pull origin main
# Make changes
git add .
git commit -m "feat: update homepage layout"
# Push directly to main
git push origin main
2️⃣ Feature Branch Workflow
Each new feature or bug fix is developed in its own branch, then merged into main or develop via a pull request.
Best for:
Teams with code review practices
Projects using CI/CD pipelines
Branch Structure
main
├── feature/login-page
├── bugfix/fix-footer
Example
git checkout -b feature/user-login
# work on feature
git commit -m "feat: add login form"
git push origin feature/user-login
# create PR to main
3️⃣ Git Flow Workflow
A more structured workflow with separate branches for development, releases, hotfixes, and features.
Best for:
- Large teams
- Projects with scheduled releases
Branch Structure
main
develop
├── feature/*
├── release/*
└── hotfix/*
Example
git checkout -b feature/user-profile develop
# complete feature, merge into develop
# prepare release: git checkout -b release/1.0.0 develop
4️⃣ GitHub Flow
A lightweight workflow where everything happens on feature branches and is merged into main
via PRs.
Best for:
- Web applications with continuous deployment
- Teams using GitHub Actions or CI tools
Branch Structure
main
├── feature/*
Example
git checkout -b feature/payment-integration
# work and commit
git push origin feature/payment-integration
# create PR into main
5️⃣ Trunk-Based Development
Developers work directly in the main
(or trunk
) branch, sometimes using short-lived branches that are merged multiple times a day.
Best for:
- High-speed deployments
- Advanced CI/CD setups
Branch Structure
main
Example
git checkout -b quick-fix
# fix and push fast
git merge --squash quick-fix into main
Choosing the Right Workflow
Workflow | Best For | Complexity |
---|---|---|
Centralized | Solo/small projects | ⭐ |
Feature Branch | Mid-size teams | ⭐⭐ |
Git Flow | Enterprise & staged releases | ⭐⭐⭐ |
GitHub Flow | Fast-moving, modern teams | ⭐⭐ |
Trunk-Based | CI/CD-first environments | ⭐⭐ |
Bonus
- Use Pull Requests to ensure code review and CI checks
- Keep feature branches short-lived
- Delete merged branches to keep repo clean
- Always pull before starting new work
Top comments (2)
Most of the time, what Git workflow are you working on? Please comment down 👇
Let us know what fits your project best!
Some comments may only be visible to logged-in visitors. Sign in to view all comments.