02-daily-development

Git Workflow

02-daily-development/git-workflow

Git Workflow

Overview

Git workflow is the sequence for branching, committing, reviewing, and merging work safely.


Why It Matters

A clean workflow reduces merge pain, makes history readable, and lowers release risk.


Core Concepts

  • Keep branches focused.
  • Commit logical units of work.
  • Rebase or merge consistently with team norms.

Mental Models

Think in checkpoints. Each commit should leave the codebase in a sensible state.


Best Practices

  • Make small commits with clear messages.
  • Pull or rebase before review if needed.
  • Resolve conflicts early.

Common Mistakes

  • Long-lived branches with many unrelated changes.
  • Mixing formatting with behavior changes.
  • Forgetting to sync with main.

Trade-offs

Rebasing keeps history tidy, while merge commits preserve branch context. Pick one team standard and be consistent.


Decision Framework

SituationPrefer
Small feature branchRebase or squash
Shared integration branchMerge carefully
HotfixFastest safe path

Examples

  • Commit message: fix auth redirect after token refresh
  • Branch name: feature/settings-permissions

Checklists

  • Is the branch up to date?
  • Are commits understandable?
  • Did I avoid unrelated file churn?

Senior Engineer Notes

Senior engineers treat Git as a collaboration tool, not just a local backup system. Good history helps future debugging and release tracking.


Further Reading