IntermediateLesson 5 of 9

Collaboration & Workflows

Implement practical team collaboration patterns including branching conventions, code ownership, review routing, and release handoffs.

Simple Explanation (ELI5)

Team workflow is the agreed way everyone works together. It decides how tasks become branches, how reviews happen, and how code gets safely merged and released.

Technical Explanation

Workflow design combines branch policy, PR rules, review ownership, and release cadence. Common models: trunk-based development, GitFlow, and hybrid release branching. Key goals: minimize integration pain, maximize delivery confidence, and keep lead time low.

Workflow Models

ModelBest ForTradeoff
Trunk-basedFast CI/CD teamsNeeds strict testing discipline
GitFlowRelease-heavy environmentsMore branch complexity
Hybrid (main + release)SaaS with periodic hardeningDual branch maintenance

Visual: Team PR Flow

Issue
feature/*
PR + CI
Code Owner Review
Merge main

Hands-on Commands

bash
# Keep local main up to date
git checkout main
git pull origin main

# Start feature from fresh main
git checkout -b feature/cart-coupon

# Regular sync while in progress
git fetch origin
git rebase origin/main

# Push and open PR
git push -u origin feature/cart-coupon

# After merge, clean up
git checkout main
git pull origin main
git branch -d feature/cart-coupon

Team Collaboration Practices

Debugging Scenarios

Real-world Use Case

A 30-engineer platform team adopted CODEOWNERS + PR templates + required checks. Mean review turnaround dropped from 18 hours to 5 hours, and release rollback frequency decreased because hidden migration risks were caught during review.

Interview Questions

Beginner

What is trunk-based development?

Developers merge small changes frequently into main with strong automated checks.

What is CODEOWNERS?

A GitHub file mapping paths to required reviewers for changes.

Why use PR templates?

To ensure every PR includes context, testing proof, and risk notes.

What is branch protection?

Rules that restrict direct pushes and require checks/reviews before merge.

What makes collaboration predictable?

Clear workflow conventions, review SLAs, and automated policy enforcement.

Intermediate

Trunk-based vs GitFlow tradeoff?

Trunk-based optimizes speed and CI; GitFlow optimizes structured release management at cost of complexity.

How reduce review bottlenecks?

Set ownership fallback, rotate reviewers, and keep PRs small enough for quick review.

How enforce “one issue per branch”?

Branch naming with ticket ID and CI check validating PR links.

Why pair code owners with required checks?

Combines human domain review with objective automated validation.

How handle cross-team dependency PRs?

Use stacked PRs and sequence merges with clear dependency notes.

Scenario-based

Multiple teams touching same module weekly. Strategy?

Strong code ownership, smaller PR slices, and frequent rebases from main.

Critical bug found during release candidate.

Create hotfix branch from release/main, fast-track review, merge, and cherry-pick where needed.

Reviewers approve but tests flaky.

Gate merge on stable checks only; quarantine flaky tests and prioritize fix.

Large refactor blocks feature delivery.

Break refactor into feature flags and incremental PRs to avoid long-lived branch drift.

Distributed team with no timezone overlap.

Use async PR templates, explicit handoff notes, and structured reviewer queues.

Summary

Good workflow design is a force multiplier. With clear branching, ownership, and review rules, teams collaborate faster with fewer release surprises.