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.

Who This Is For
  • Teams turning commands into repeatable routines
  • Readers who need sequencing, branch, and sync discipline
Prerequisites
  • Basic understanding of fetch, pull, push, and branches
  • A sense of how and why branches diverge
Common Risks
  • Copying a workflow without checking branch state
  • Choosing the wrong integration path on shared branches

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 Collaboration PatternFeature branch is cut from main, developed independently, then merged back. During development, regularly sync main changes to avoid large conflicts at merge time.
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 origin regularly
  • choose merge or rebase consciously
  • 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:

  1. the branch is current enough
  2. the diff still matches the intended feature scope
  3. 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

  1. Practice the feature-branch-collaboration command in a test repository and observe state changes before and after
  2. Experiment with different options and compare the output differences
  3. 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: