Git Workflow and Branching Strategy
Overview
This document outlines the Git workflow and branching strategy for the Quantum Platform development.
Branch Structure
Main Branches
main- Production-ready code, always deployabledevelop- Integration branch for features, staging environment
Supporting Branches
feature/*- New features and enhancementsbugfix/*- Bug fixes for the current releasehotfix/*- Critical fixes for productionrelease/*- Release preparation and stabilization
Branch Naming Conventions
Feature Branches
feature/QUANTUM-123-add-user-authentication
feature/QUANTUM-456-implement-api-gateway
Bug Fix Branches
bugfix/QUANTUM-789-fix-login-validation
bugfix/QUANTUM-101-fix-database-connection
Hotfix Branches
hotfix/QUANTUM-202-security-patch
hotfix/QUANTUM-303-critical-bug-fix
Release Branches
release/v1.2.0
release/v2.0.0-beta
Workflow Process
1. Feature Development
-
Create feature branch from develop:
git checkout develop
git pull origin develop
git checkout -b feature/QUANTUM-123-add-user-authentication -
Develop and commit:
git add .
git commit -m "feat: add user authentication module" -
Push and create PR:
git push origin feature/QUANTUM-123-add-user-authentication -
Create Pull Request to
develop
2. Bug Fixes
-
Create bugfix branch from develop:
git checkout develop
git pull origin develop
git checkout -b bugfix/QUANTUM-789-fix-login-validation -
Fix and commit:
git add .
git commit -m "fix: resolve login validation issue" -
Push and create PR to
develop
3. Release Process
-
Create release branch from develop:
git checkout develop
git pull origin develop
git checkout -b release/v1.2.0 -
Update version numbers and changelog
-
Merge to main and develop:
git checkout main
git merge release/v1.2.0
git tag v1.2.0
git checkout develop
git merge release/v1.2.0
4. Hotfix Process
-
Create hotfix branch from main:
git checkout main
git pull origin main
git checkout -b hotfix/QUANTUM-202-security-patch -
Fix and commit:
git add .
git commit -m "hotfix: apply security patch" -
Merge to main and develop:
git checkout main
git merge hotfix/QUANTUM-202-security-patch
git tag v1.2.1
git checkout develop
git merge hotfix/QUANTUM-202-security-patch
Commit Message Convention
We follow the Conventional Commits specification:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests or correcting existing tests
- chore: Changes to the build process or auxiliary tools
Examples
feat(auth): add OAuth2 integration
fix(api): resolve database connection timeout
docs: update API documentation
refactor(ui): simplify component structure
Branch Protection Rules
Main Branch Protection
- Require pull request reviews (2 reviewers minimum)
- Require status checks to pass
- Require branches to be up to date
- Restrict pushes to main branch
- Require linear history
Develop Branch Protection
- Require pull request reviews (1 reviewer minimum)
- Require status checks to pass
- Allow force pushes for maintainers
Pre-commit Hooks
The repository includes pre-commit hooks that enforce:
- Intent Reference Headers: All source files must include
intent_refheaders - Linting: Python (flake8) and JavaScript/TypeScript (ESLint) linting
- Security Checks: Detection of hardcoded secrets and SQL injection patterns
- ADR Requirements: Changes to context.md require Architecture Decision Records
Code Review Process
Pull Request Requirements
- Description: Clear description of changes and motivation
- Testing: Evidence of testing (unit tests, integration tests)
- Documentation: Updated documentation if needed
- Breaking Changes: Clearly marked if applicable
- ADR: Architecture Decision Record for significant changes
Review Checklist
- Code follows project conventions
- Tests are included and passing
- Documentation is updated
- No hardcoded secrets or credentials
- Security implications considered
- Performance impact assessed
- Breaking changes documented
Environment Branches
main→ Production environmentdevelop→ Staging environmentfeature/*→ Development environment (per feature)
Emergency Procedures
Critical Bug in Production
- Create hotfix branch from main
- Implement minimal fix
- Test thoroughly
- Merge to main and tag
- Deploy immediately
- Merge back to develop
Rollback Procedure
- Identify last known good commit
- Create rollback branch
- Revert problematic changes
- Test rollback
- Deploy rollback
- Create follow-up issue for proper fix
Best Practices
- Keep branches small and focused
- Commit frequently with meaningful messages
- Always pull latest changes before starting work
- Use feature flags for incomplete features
- Write tests before implementing features
- Document breaking changes
- Use semantic versioning for releases
- Keep main branch always deployable
Tools and Automation
- GitHub Actions: CI/CD pipeline
- Pre-commit hooks: Code quality enforcement
- Branch protection: Automated branch rules
- Dependabot: Dependency updates
- Code scanning: Security vulnerability detection
Getting Help
- Review this document first
- Check existing issues and PRs
- Ask in team channels for guidance
- Escalate to platform architects for architectural decisions