Let's chat on WhatsApp!
You are about to be connected to a spa consultant via WhatsApp.
To proceed, please make sure that your phone or device has the WhatsApp application installed.
1. What is Trunk-Based Development (TBD)? Trunk-Based Development is a source control strategy where developers merge all changes directly into a single shared branch (the "trunk" or main ) multiple times a day. Instead of long-lived feature branches, teams use short-lived feature branches (lasting less than a day) or commit directly to the trunk.
❌ Multiple active release branches (e.g., release/spring , release/summer ). ❌ Feature branches older than 2 days. ❌ Development branch ( dev ) that lags behind main . 7. CI Pipeline Architecture for TBD in Salesforce Commit to main │ ▼ [Fast CI] (< 5 min) - Lint (PMD, ESLint) - Validate metadata syntax - Quick Apex tests (0-10% coverage) │ ▼ (if passes) [Medium CI] (< 15 min) - Deploy to validation scratch org - Run all Apex tests - Run destructive changes simulation │ ▼ (if passes) [Slow CI] (< 30 min) - Deploy to full copy sandbox - Run regression suite - Build unlocked package (if applicable) - Deploy to staging org 8. Metrics to Measure Success | Metric | Target | How to Measure | |--------|--------|----------------| | Branch lifetime | < 24 hours (average 4-6 hours) | Git analytics | | Time from PR open to merge | < 1 hour | GitHub/ADO metrics | | CI pass rate on main | > 95% | Build monitoring | | Merge conflicts per sprint | < 3 | Team retro | | Deployment failures to production | 0 per month | Change success rate | 9. Common Pitfalls (and Fixes) for Salesforce Teams | Pitfall | Solution | |---------|----------| | "We need long branches because profiles are hard to merge" | Move profile overrides to Permission Sets or use sfdx-git-delta . | | "Our scratch orgs take 30 minutes to create" | Use pre-configured scratch orgs (snapshots) or increase CI parallelism. | | "We can't test all Apex in 10 minutes" | Split tests: critical path (fast) vs. full regression (slow). | | "Our UAT requires a stable environment" | Deploy main to a dedicated UAT sandbox daily, not per commit. | | "We have managed packages that require versioning" | Use CI to auto-increment package version on each merge to main . | 10. Sample .gitattributes for Salesforce TBD To reduce merge conflicts in metadata XML files: salesforce trunk-based development
| Mechanism | Use Case | Example | |-----------|----------|---------| | (Hierarchy) | Per-user, per-org rollout | FeatureToggle__c.enableNewDashboard__c | | Custom Metadata Type | Bulk configuration | Feature_Flag__mdt queried in Apex | | Permission Set | Visibility gates | New Lightning page assigned only to test users | | Apex if statements | Code-level toggle | if(FeatureService.isEnabled('NEW_FLOW')) | ❌ Development branch ( dev ) that lags behind main
You are about to be connected to a spa consultant via WhatsApp.
To proceed, please make sure that your phone or device has the WhatsApp application installed.
You are about to be connected with a spa consultant via Zalo.
To continue, please make sure that your phone or device has Zalo application installed.