Git Flow / GitHub Flow Setup for Team Development
Without agreed branch strategy, teams of 3+ inevitably get main conflicts, unclear deployment timing, and regular "who broke production" incidents. Git Flow and GitHub Flow — two proven approaches with different trade-offs.
Git Flow: When It Fits
Git Flow makes sense with: infrequent releases (weekly or less), need to support multiple versions, complex hotfix processes.
Branch structure:
-
main— production-ready code only, version tags -
develop— integration branch, source for feature branches -
feature/ticket-123-user-auth— feature development -
release/1.5.0— release preparation (bugfixes, version updates) -
hotfix/1.4.1-payment-fix— urgent production fixes
# Initialize Git Flow
git flow init
# Start feature
git flow feature start user-authentication
# Finish feature (merge to develop)
git flow feature finish user-authentication
# Create release
git flow release start 1.5.0
# ... final fixes, update CHANGELOG
git flow release finish 1.5.0
GitHub Flow: When It Fits
GitHub Flow is simpler and better for continuous delivery: deploy happens on every main merge.
Rules:
-
main— always deployable - Everything happens in branches from
main - Name branches clearly:
feat/user-dashboard,fix/checkout-crash,chore/update-deps - Open PR for any change
- Deploy from branch, merge only after production verification
Naming Conventions
Unified branch naming reduces cognitive load:
feat/JIRA-123-short-description # new feature
fix/JIRA-456-bug-description # bug fix
chore/update-node-20 # technical tasks
docs/update-api-reference # documentation
refactor/extract-payment-service # refactoring
Branch Protection Rules
In GitHub Settings → Branches configure main protection:
- Require pull request before merging — direct push to main forbidden
- Require approvals: 1 — minimum one approval from another developer
- Require status checks to pass — CI must pass
- Require branches to be up to date — branch must be current before merge
- Do not allow bypassing the above settings — applies even to administrators
.gitconfig and Templates
Commit message template for team:
# .gitmessage
# Type: feat, fix, docs, chore, refactor, test, perf
# feat(auth): add OAuth via Google
#
# Body (optional): what and why, not how
#
# JIRA: PROJ-123
git config --global commit.template ~/.gitmessage
Timeline
Choosing and documenting process, configuring branch protection rules, templates and hooks for team — 0.5–1 day.







