Status: Accepted
Date: 2025-11-14
Deciders: Architecture Team
Context: Version Control and Change Management Strategy
We need to define a standardized version control workflow for the microservices architecture project. The workflow must:
- Support continuous integration and continuous delivery (CI/CD)
- Minimize merge conflicts and integration issues
- Align with our Kanban methodology (continuous flow)
- Enable rapid feedback cycles
- Work well with microservices and event-driven architecture
- Support multiple teams working simultaneously
- Facilitate easy rollbacks and hotfixes
- Scale as the team and codebase grow
We will adopt Trunk-Based Development (TBD) with short-lived feature branches as our primary version control strategy.
- Single Main Branch:
main(ormaster) is the single source of truth - Short-Lived Branches: Feature branches live for maximum 2-3 days
- Frequent Integration: Merge to main at least once per day
- Feature Flags: Use feature toggles for incomplete features
- Automated Testing: Comprehensive CI/CD pipeline with automated tests
- Small Commits: Commit small, incremental changes frequently
- Release from Main: All releases are created directly from the main branch
main (trunk)
│
├─── feature/TASK-001-add-order-validation (1-2 days)
│ └─── merge to main
│
├─── feature/TASK-002-payment-integration (2-3 days)
│ └─── merge to main
│
├─── hotfix/FIX-urgent-payment-bug (< 1 day)
│ └─── merge to main
│
└─── release/v1.2.0 (tag only, not a branch)
- main: The trunk - always deployable
- feature/TASK-XXX-description: Short-lived feature branches (1-3 days max)
- hotfix/FIX-description: Emergency fixes (< 1 day)
- release/vX.Y.Z: Tags only, not branches (created from main)
We also evaluated Git Flow but decided against it for the following reasons:
Git Flow Structure:
- Long-lived
developandmainbranches - Feature branches from
develop - Release branches for preparing releases
- Hotfix branches from
main
Why Not Git Flow:
- ❌ Too much ceremony for continuous deployment
- ❌ Long-lived branches increase merge conflicts
- ❌ Slower integration cycles
- ❌ Complex branch management overhead
- ❌ Not optimal for microservices (each service can release independently)
- ❌ Contradicts Kanban continuous flow principles
When Git Flow Makes Sense:
- Multiple production versions maintained simultaneously
- Scheduled release cycles (e.g., quarterly)
- Desktop/mobile apps with app store approval delays
- Large teams with slower release cadence
For reference, Git Flow remains documented as an alternative strategy in our guides.
-
Continuous Integration
- Developers integrate code multiple times per day
- Early detection of integration issues
- Reduces "integration hell"
-
Faster Feedback
- Code reaches main branch quickly
- Automated tests run on every commit
- Issues discovered and fixed rapidly
-
Reduced Merge Conflicts
- Short-lived branches minimize divergence
- Frequent merges keep code synchronized
- Less time spent resolving conflicts
-
Better for Microservices
- Each service can release independently
- No coordination overhead between services
- Aligns with microservices autonomy
-
Supports Kanban
- Continuous flow without batch releases
- Work items move smoothly through pipeline
- No waiting for release windows
-
Enables CI/CD
- Main branch always deployable
- Automated deployment pipelines
- Rapid delivery to production
-
Industry Best Practice
- Used by Google, Facebook, Netflix, Amazon
- Proven at scale with thousands of developers
- Supported by DevOps Research and Assessment (DORA) metrics
-
Feature Flags/Toggles
- Deploy incomplete features hidden behind flags
- Enable gradual rollout
- Quick rollback without code changes
-
Comprehensive Testing
- Unit tests (>80% coverage)
- Integration tests for critical paths
- Contract tests for events
- Automated E2E tests
-
Code Review Process
- All changes reviewed before merge
- Automated checks (linting, tests, security)
- Maximum 24-hour review turnaround
-
Monitoring and Observability
- Structured logging
- Metrics and dashboards
- Alerts for anomalies
- Quick rollback capability
- ✅ Faster time to production
- ✅ Reduced integration problems
- ✅ Improved code quality through frequent review
- ✅ Better alignment with Kanban workflow
- ✅ Simplified branch management
- ✅ Enables true continuous deployment
- ✅ Easier rollbacks (linear history)
- ✅ Better team collaboration
⚠️ Requires discipline and training⚠️ Need robust automated testing⚠️ Feature flags add complexity⚠️ May feel uncomfortable for teams used to Git Flow⚠️ Requires good CI/CD infrastructure
- Training: Provide comprehensive onboarding and documentation
- Tooling: Invest in CI/CD pipeline and feature flag management
- Monitoring: Implement robust observability to catch issues early
- Culture: Foster trust and encourage frequent small commits
- Support: Architecture team available for questions and guidance
-
Phase 1: Foundation (Week 1)
- Create comprehensive workflow documentation
- Set up branch protection rules
- Configure CI/CD pipelines
-
Phase 2: Training (Week 2)
- Team training sessions
- Pair programming to demonstrate workflow
- Create example pull requests
-
Phase 3: Pilot (Week 3-4)
- Start with one microservice
- Gather feedback
- Adjust processes as needed
-
Phase 4: Rollout (Week 5+)
- Apply to all microservices
- Monitor metrics (lead time, deployment frequency)
- Continuous improvement
- Deployment Frequency: Daily deployments to production
- Lead Time: < 24 hours from commit to production
- Mean Time to Recovery: < 1 hour
- Change Failure Rate: < 15%
- Branch Lifetime: Average < 2 days
- Code Review Time: < 4 hours
- Trunk Based Development
- Google's Approach to Trunk-Based Development
- Accelerate: The Science of Lean Software and DevOps - DORA Research
- Feature Toggles (Feature Flags) - Martin Fowler
- Continuous Integration - Martin Fowler
This decision can be revisited if:
- Team size exceeds 100 developers
- Deployment frequency requirements change significantly
- Multiple production versions need to be maintained
- Regulatory requirements demand different release processes