Workflows
Feature Branch Collaboration
A practical feature-branch workflow for day-to-day teamwork, from cutting the branch and syncing main to cleaning the stack before review.
- Teams turning commands into repeatable routines
- Readers who need sequencing, branch, and sync discipline
- Basic understanding of fetch, pull, push, and branches
- A sense of how and why branches diverge
- Copying a workflow without checking branch state
- Choosing the wrong integration path on shared branches
Where this workflow fits
This is the most common collaboration path: branch from main, develop in isolation, keep the branch reasonably current, clean up the history, and open review.
A safer baseline flow
Feature branch cut from main
main
ABC
feature
BDE
Merged back to main
main
ABCM
feature
BDEM
git switch main
git pull --ff-only
git switch -c feature/login-validation
During development:
- run
git fetch originregularly - choose
mergeorrebaseconsciously - keep commits readable and scoped
Before review:
git fetch origin
git rebase origin/main
git log --oneline --decorate -5
A fuller day-to-day rhythm
git switch main
git pull --ff-only
git switch -c feature/login-validation
# work and commit
git fetch origin
git rebase origin/main
git diff --stat origin/main...
git push -u origin feature/login-validation
Why this workflow holds up well
- branch boundaries stay clear
- review scope is obvious
- rollback and cherry-pick stay easier
- half-finished work does not leak into main
Key checks before review
git branch -vv
git diff --stat origin/main...
git log --oneline --decorate -8
Confirm:
- the branch is current enough
- the diff still matches the intended feature scope
- recent commits are understandable
Common mistakes
- developing directly on main
- letting the branch drift too far from main
- opening review before cleaning noisy commits
- mixing unrelated work into one feature branch