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

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