Minimalist branching model designed for continuous deployment. Only two elements — main and feature branches — with PRs as the integration point and immediate deploy after merge.
GitHub Flow is a simplified branching model created by GitHub in 2011 as a lightweight alternative to GitFlow. Its premise: main is always deployable, and every change goes through a Pull Request.
GitFlow was designed for software with scheduled releases. But for teams deploying multiple times a day, its multiple branches (develop, release/*, hotfix/*) add friction without benefit.
GitHub Flow reduces everything to the essentials:
main: ──●────●────●────●────●──
\ / \ / \ /
feature: ● ● ●
main is always deployable — any commit on main can go to productionfeature/add-login, fix/header-overflow# 1. Create branch from updated main
git checkout main
git pull origin main
git checkout -b feature/user-notifications
# 2. Work and commit
git add .
git commit -m "feat: add notification preferences UI"
git push -u origin feature/user-notifications
# 3. Open PR on GitHub
gh pr create --title "feat: user notifications" --body "Adds notification preferences"
# 4. Iterate based on review
git commit -m "fix: address review comments"
git push
# 5. Merge after approval (squash recommended)
gh pr merge --squash
# 6. Automatic deploy (CI/CD handles it)
# main → staging → productionIdeal for:
Consider alternatives when:
| Aspect | GitHub Flow | GitFlow |
|---|---|---|
| Permanent branches | 1 (main) | 2 (main, develop) |
| Temporary branches | feature/* | feature/*, release/*, hotfix/* |
| Complexity | Minimal | High |
| Deploy | Continuous | Per release |
| Hotfixes | Same as features | Special branch from main |
| Ideal for | Web apps, SaaS | Versioned software, enterprise |
Allow merging incomplete code to main without exposing it to users:
if (featureFlags.isEnabled('new-checkout')) {
return <NewCheckout />;
}
return <LegacyCheckout />;Benefits:
Deploy the branch before merging to validate in a real environment:
# .github/workflows/branch-deploy.yml
on:
pull_request:
types: [labeled]
jobs:
deploy-preview:
if: github.event.label.name == 'deploy-preview'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./deploy-to-preview.shStructure messages to generate automatic changelogs:
feat: add user notifications
fix: resolve header overflow on mobile
docs: update API documentation
chore: upgrade dependencies
name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
- run: npm run lint
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build
- run: ./deploy.shGitHub Flow is the most widely adopted branching model for teams practicing continuous delivery. Its simplicity — a single main branch, short-lived feature branches, deploy after merge — eliminates the ceremony of more complex models like GitFlow and reduces the time between writing code and shipping it to production.
Distributed version control system created by Linus Torvalds in 2005. Foundation of every modern development workflow — from local commits to global collaboration.
Collaborative development platform built on Git. More than repository hosting — it's the central hub for code review, CI/CD, project management, and open source collaboration.
Branching model for Git proposed by Vincent Driessen in 2010. Defines branches with fixed roles (main, develop, feature, release, hotfix) for managing structured releases.
Code organization strategy where multiple projects coexist in a single repository, sharing dependencies, configuration, and build tooling.
Continuous Integration and Continuous Delivery/Deployment — practices that automate code integration, testing, and delivery to production. Foundation of modern software engineering.