
Serpent Team

Andrew Hanna

TL;DR: Pick your branching model from two inputs, team size and sandbox topology, and nothing else. Under about four contributors with only developer sandboxes, use one main branch and short-lived feature branches. Between four and ten with a partial copy for UAT, add a release branch per release and stop there. Above that, or with a full sandbox and a fixed change window, GitFlow earns its ceremony. Branch per environment is a compliance choice, not an engineering one.
Three things, and only three: where work in progress lives, how a change is promoted to the next environment, and what has to be true before something reaches production. Everything else is diagram decoration.
Salesforce teams get this wrong because the general engineering advice assumes something that is not true on the platform: that a branch gives you somewhere to run it.
One long-lived branch, main, that always reflects what production should
be. Feature branches live days, not weeks, and merge back through a pull request.
Fewest moving parts, fewest conflicts, hardest discipline.
main for released code, develop for integrated work, plus
release and hotfix branches. Built for scheduled releases and for maintaining a live
version while the next one is being built. It costs you an extra permanent branch and
a lot of merging.
One branch mirroring each org: dev, UAT, staging, production. It is usually the first thing teams build, because it looks like the org landscape they already have. Promotion becomes a merge between environment branches, which sounds tidy and turns into merges of merges plus routine cherry-picking.
This is where most branching articles stop and where the real decision lives.
develop; you do not have the sandbox count to
justify it.
Notice that release cadence barely appears. Cadence is an output of your sandbox topology, not an independent input, and teams that pick a model by desired cadence end up with a process their environments cannot support.
main with production and treat the diff as a real backlog,
not a curiosity. It is usually where the surprises are.
The model that survives contact with a real team is the one the pipeline enforces, not the one in the onboarding doc. If a consultant has to remember the branching rules, the rules will be broken during the first busy release week. Serpent runs a ticket-based workflow with Git in the background, so the branch, the pull request and the promotion path come from the ticket rather than from memory. More pipeline guides live in our SF Guides library.
Is trunk-based development realistic for a team of admins?
Yes, and it is usually easier for admins than GitFlow, because there is one branch to understand. The discipline that matters is short branches, not Git fluency.
Do we need one Git branch per sandbox?
No. A sandbox is a deployment target. Mapping one branch to each org is the main cause of merges of merges and permanent cherry-picking.
How long should a Salesforce feature branch live?
Days. One sprint is the outer limit. Beyond that, metadata drift and profile conflicts cost more than the branch saves.
How do hotfixes work under trunk-based?
Branch from the last released commit, fix, validate, deploy, then merge back into main immediately so the fix is not lost on the next release.
Does the model change for 2GP package teams?
Yes. Branch by package version and test in scratch orgs. Environment branches model an org landscape that a package team does not release into.
Commitment free!