Octonote AI
Make your own →

Note

A Git branching workflow that scales

Sunil Tiwari· Oct 12, 2026 · 1 min

Diagram-as-code next to real commands: the Mermaid block renders the branch history, the code blocks are copy-pasteable.

The shape of history

gitGraph
  commit id: "init"
  branch feature/login
  checkout feature/login
  commit id: "form"
  commit id: "validation"
  checkout main
  branch fix/typo
  commit id: "typo"
  checkout main
  merge fix/typo
  merge feature/login
  commit id: "release 1.2" tag: "v1.2.0"

Daily loop

git switch main && git pull --rebase
git switch -c feature/login
# …work, small commits…
git push -u origin feature/login
gh pr create --fill

Keep the branch fresh

git fetch origin
git rebase origin/main      # replay your commits on top
git push --force-with-lease # safe force-push

Rules that keep main green

  1. Branches live less than two days.
  2. Every merge goes through a pull request with CI passing.
  3. Squash-merge features, so main reads like a changelog.
  4. Release by tagging main — no long-lived release branches.
Was this useful?
Written bySunil Tiwari
Notes and canvases, together.This page was made with Octonote AI. Publish your own in one click.
Get started free