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 --fillKeep the branch fresh
git fetch origin
git rebase origin/main # replay your commits on top
git push --force-with-lease # safe force-pushRules that keep main green
- Branches live less than two days.
- Every merge goes through a pull request with CI passing.
- Squash-merge features, so
mainreads like a changelog. - Release by tagging
main— no long-lived release branches.
Was this useful?
Notes and canvases, together.This page was made with Octonote AI. Publish your own in one click.
Get started free