Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# Trunk-Based Development principles: # 1. Everyone commits to main (or very short-lived branches < 2 days). # 2. CI runs on every commit — must stay green. # 3. Use feature flags to hide incomplete features in production. # 4. Small, incremental commits over large batches. # Short-lived feature branch (merged same day or next): git switch main && git pull git switch -c feat/add-search-bar # ... small focused changes ... git add . && git commit -m "feat: add search bar UI component" git push -u origin feat/add-search-bar # Open PR -> quick review -> merge -> delete branch # Feature flag pattern (simple example): # config/features.js # module.exports = { # newDashboard: process.env.FF_NEW_DASHBOARD === 'true', # betaCheckout: process.env.FF_BETA_CHECKOUT === 'true', # }; # Usage in code: # const flags = require('./config/features'); # if (flags.newDashboard) { # return res.render('dashboard-v2'); # } # return res.render('dashboard'); # When the feature is complete and rolled out: # 1. Remove the feature flag check # 2. Delete the flag from config # 3. Clean up old code path
Result
Open