Feature Branch Workflow is a team development approach where every task is done in a separate branch. It’s the most popular workflow in modern teams.
The Problem Without Branches
Imagine a team of three developers all working in main:
Morning:
Ivan β adding a login form
Maria β fixing a bug in the cart
Alexey β building a new page
Lunch:
Ivan pushes β breaks Maria's code
Maria pushes β conflicts with Ivan
Alexey watches the chaos β can't work
Result: No one can work properly, main is constantly broken.
The Solution: Each Task Gets Its Own Branch
main βββββββββββββββββββββββββββββββββββββββββββ
Ivan: feature/login
βββββββββββββββ PR β merge
Maria: fix/cart-bug
βββββββββ PR β merge
Alexey: feature/catalog
ββββββββββββ PR β merge
Everyone works independently. main is stable and always ready to deploy.
The Full Workflow
1. Start with an up-to-date main
git checkout main
git pull origin main # get the latest changes
In GitHub Desktop: switch to main β Fetch origin β Pull.
2. Create a branch
git checkout -b feature/user-profile
In GitHub Desktop: Branch β New Branch β name your branch.
Naming conventions:
| Type | Pattern | Example |
|---|---|---|
| New feature | feature/name |
feature/user-profile |
| Bug fix | fix/name |
fix/login-crash |
| Documentation | docs/name |
docs/api-guide |
| Refactoring | refactor/name |
refactor/auth-module |
3. Work and commit
# Done part of the work
git add .
git commit -m "feat: add profile page"
# More changes
git commit -m "feat: avatar upload"
# Fixed something
git commit -m "fix: username validation"
4. Push the branch
git push origin feature/user-profile
In GitHub Desktop: Push origin (or Publish branch on first push).
5. Create a Pull Request
GitHub will show a banner: “Compare & pull request”. Click it.
Fill in the description:
- What was done
- Why
- How to test
6. Go through code review
Reviewer looks at the code and leaves comments.
You make changes and push β the PR updates.
7. Merge and delete the branch
After Approve: Merge pull request β Delete branch.
# Locally: switch to main and update
git checkout main
git pull origin main
git branch -d feature/user-profile # delete local branch
Multiple Tasks in Parallel
The main strength of Feature Branches is handling several tasks simultaneously:
# Working on the login feature
git checkout feature/login
# A critical bug came in β switch over
git checkout main
git checkout -b fix/critical-bug
# Fixed the bug, merged via PR
# Back to the login feature β nothing lost
git checkout feature/login
Without branches you’d have to stash or revert unfinished work.
Branch Lifecycle
Created from main β Work β PR β Review β Merge β Deleted
β β
βββββββββββββ Review fixes ββββββββββββββββββββββ
A branch lives exactly as long as it’s needed. After merge β it’s deleted.
What If main Updated While I Was Working?
Another developer merged their PR while you were working in your branch.
You need to update your branch:
git checkout feature/my-feature
git merge main # pull updates from main into your branch
In GitHub Desktop: Branch β Update from default branch.
If there’s a conflict β see the article Resolving Merge Conflicts.
Rules of Good Practice
Small branches β
feature/add-email-field β 50 lines changed β 1 hour of review
vs
feature/redesign-everything β 3000 lines β reviewer cries
Small PRs get merged faster. Large ones “hang” for weeks.
One task β one branch β
# Good: each task in its own branch
feature/add-login
feature/add-registration
fix/password-validation
# Bad: everything in one branch
feature/auth-system # login, registration, fix, and refactoring all in one...
Descriptive branch names β
The branch name should make its purpose clear:
β
feature/user-avatar-upload
β
fix/cart-total-calculation
β my-branch
β test
β new-stuff
Feature Branch in Different Teams
GitHub Flow (simple)
main β feature branch β PR β merge into main β deploy
Used in most small teams and open source projects.
Git Flow (complex)
main β develop β feature β develop β release β main
Used in teams with defined release cycles.
For learning and most projects, GitHub Flow is sufficient.
Summary
Feature Branch Workflow means:
- Isolation β each task in its own branch
- Stability β
mainalways works - Review β code is checked before merge
- History β clear record of what was added and when
This is the approach used at most tech companies worldwide β from small startups to Google and Microsoft.
π¬ Comments (0)
No comments yet
Be the first to share your opinion about this article!