Ideal Salesforce Branching Strategy and Deployment Workflow
A comprehensive guide to establishing a clean, scalable Git branching strategy for Salesforce projects with CI/CD automation and enterprise governance
In Salesforce projects, establishing a clear, scalable Git branching strategy is more than a DevOps best practice โ it's a prerequisite for smooth collaboration, CI/CD automation, and long-term maintainability. The diagram below outlines an ideal branching and deployment workflow, particularly suited to enterprise Salesforce implementations.
It's also the model Navceed more or less follows โ especially in how it minimizes unnecessary long-lived branches and leverages GitHub Actions to handle both CI and CD tasks within a unified automation layer.
VSCode + Dev Sandbox
feature/xyz
GitHub Actions
PreProd Org
release_sprint_01
to main
Detects main merge
Build & Validate
Production Org
Optional
Planned Date
Why This Workflow Matters
Salesforce development is fundamentally different from traditional software engineering. Changes are often made in metadata-rich sandboxes with inconsistent state across environments. That makes a clean, opinionated branching model essential to avoid chaos in releases.
This strategy balances developer flexibility with organizational control โ enabling structured deployments across multiple stages while keeping the number of persistent branches to a minimum.
Summary of the Flow
This model consists of 16 steps, flowing left to right from local development to production deployment, with GitHub (or any VCS) at the center. It encourages:
- โขShort-lived feature and release branches
- โขLong-lived
preprod
andmain
branches - โขPull Request (PR) gates for review and automation
- โขUnified automation through GitHub Actions or equivalent
- โขOptional change management integration for enterprise approvals
Here's a quick walk-through:
๐งฑ Local Development
- โขDevelop in a local VSCode + Dev Sandbox.
- โขCommit changes to a remote feature branch (e.g.,
feature/xyz
) on GitHub.
๐ PreProd Cycle
- โขRaise a PR from feature to
preprod
branch. - โขCode is reviewed and merged to
preprod
. - โขThe CD Tool (e.g., GitHub Actions) detects the merge and triggers the CI build job.
- โขThe CI Tool (same GitHub Actions workflow or a separate process) builds, scans, and deploys to PreProd Org.
๐ฆ Release and Promotion
- โขCreate a short-lived release branch (e.g.,
release_sprint_01
). - โขMerge the reviewed feature into the release branch.
- โขRaise a PR from release to
main
. - โขReview and merge into
main
.
๐ Production Pipeline
- โขCD Tool listens for merges into
main
and triggers the CI Tool. - โขCI Tool builds, scans, and validates the metadata against the Production Org.
- โขCI Tool sends back the success/failure status to the CD Tool.
๐ Optional Change Management
- โขOn successful validation, an automated Change Record is created in the Change Management Tool.
- โขValidated package is deployed on the planned date using quick deploy.
- โขThe change record is closed manually or automatically.
Tooling Notes
- โขUnified Automation: Although labeled separately as "CI Tool" and "CD Tool" for clarity, both can be implemented using the same GitHub Actions pipeline โ as Navceed does โ without the need for separate platforms.
- โขChange Management (Steps 14โ16): These are optional and depend on enterprise governance policies.
- โขPreProd Is Persistent: The
preprod
branch is long-lived and acts as a staging ground for changes, not a short-lived integration branch.
Short-Lived Branching Discipline
This workflow intentionally limits the lifespan of feature and release branches. By treating them as isolated, short-term contexts, it:
- โขReduces merge complexity
- โขEncourages continuous integration
- โขKeeps
preprod
andmain
free from unreviewed code - โขPrevents long-term drift between environments
preprod
and main
remain stable, long-lived branches used as promotion gates.
Closing Thoughts
While tools like Navceed bring this strategy to life, the real value lies in the structure: a branching model that maps well to Salesforce's sandbox-driven deployment world, enforces review gates, and enables automated delivery without introducing tool bloat.
The workflow outlined above isn't theoretical โ it's been applied and battle-tested. It works across teams, scales well with enterprise controls, and avoids the overhead of unnecessarily complex branching.