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
Citations & Further Reading
- Distributed Git Contributing to a Project [Book]
- Git Branching Basic Branching and Merging [Book]
- Git switch [Official]
What you will learn
- Understand the core purpose of Feature Branch Collaboration
- Master the basic usage and common options of 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.
- Understand key concepts: Where this workflow fits
- Know when to use this feature and when to avoid it
Start with a problem
Your team is collaborating on a project, branches are growing, merges are becoming more frequent — but there's no stable collaboration rhythm. Everyone syncs code their own way, and conflicts are piling up.
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
Try it yourself
- Practice the feature-branch-collaboration command in a test repository and observe state changes before and after
- Experiment with different options and compare the output differences
- Simulate a real scenario where you would need to use this, and walk through the full process
Further reading
Keep going on the same topic: