A Clean Git Branching Strategy for Teams
Keep main green, reviews meaningful and releases boring. A lightweight branching workflow that scales from solo to team.
Your branching model is your team's safety net. The best ones are boring: a protected main, short-lived feature branches, and pull requests that are small enough to actually review.
The workflow
- Branch off
mainfor every change. - Commit small, with messages that say why.
- Open a pull request early — even as a draft.
- Squash-merge back to
main.
Start a change
git checkout main
git pull --rebase
git checkout -b feat/invoice-pdfCommit messages that age well
# conventional style: type(scope): summary
git commit -m "feat(invoicing): render PDF on export"
git commit -m "fix(api): clamp page size to 500"
git commit -m "refactor(db): extract quote builder"Write the why in the body, not the title. Six months later, "why did we do this" is the only question that matters.
Keep your branch fresh
# replay your work on top of latest main
git pull --rebase origin main
# if a conflict:
git add <resolved-file>
git rebase --continueShip it
git push -u origin feat/invoice-pdf
# open the PR, get review, then squash-merge
# afterwards, clean up:
git checkout main && git pull
git branch -d feat/invoice-pdfProtect main in your host (require PRs, passing CI, at least one review). The ceremony is small; the payoff is a history you can actually read and a branch you can always deploy.
More from the lab
Build a Local Chatbot with Ollama, Python & React
Run an LLM on your own machine with Ollama and put a chat UI in front of it — no cloud, no keys.
AI & MLModel Context Protocol (MCP): Give Your AI Real Tools
MCP lets AI call your tools, files and APIs. Here's what it is and how to expose one in a dozen lines.
AI & MLClassifiers, Regressors & Clusters: The 3 Shapes of ML
Almost every ML problem is one of three shapes — here's how to recognise and solve each with scikit-learn.
Want us to build this for you?
We turn tutorials like these into production systems every day. Tell us what you need.
Start a project →