Branching Strategy¶
This document defines the Git branching strategy and practices for ConnectSoft repositories. It is written for engineers understanding how we manage code branches and Git workflows.
ConnectSoft uses a Git branching strategy that supports both Factory-generated code and manual development. The strategy enables parallel development, code review, and safe deployments while maintaining a clean, linear history.
Tip
Keep branches short-lived and focused. Merge frequently to avoid long-lived branches that become difficult to merge. Use feature branches for all changes, whether Factory-generated or manual.
Branch Types¶
Main Branch¶
Purpose: Production-ready code that has been tested and approved.
Characteristics: - Always deployable - Protected (requires PR and approval) - All commits are tagged with version numbers - Never commit directly to main
Develop Branch (Optional)¶
Purpose: Integration branch for features ready for testing.
When to Use: - Large teams with multiple features in progress - Need staging environment that's ahead of main
When NOT to Use: - Small teams - Simple workflows - Prefer feature branches → main directly
Feature Branches¶
Purpose: Development branches for new features or changes.
Naming: feature/description (e.g., feature/invoice-service, feature/add-payment-method)
Characteristics: - Created from main (or develop) - Merged back via PR - Deleted after merge - Short-lived (days, not weeks)
Hotfix Branches¶
Purpose: Critical production fixes that need immediate deployment.
Naming: hotfix/description (e.g., hotfix/security-patch, hotfix/payment-bug)
Characteristics: - Created from main - Merged to main and develop (if exists) - Deleted after merge - Bypass normal process for urgent fixes
Release Branches (If Used)¶
Purpose: Prepare releases with version bumps and final testing.
Naming: release/version (e.g., release/1.2.0)
When to Use: - Need to prepare releases with version bumps - Final testing before production - Not commonly used (prefer tags on main)
Workflow for Features and Fixes¶
New Feature Workflow¶
Steps:
-
Create Feature Branch
-
Develop or Generate
- Option A: Request Factory to generate code (Factory creates branch)
-
Option B: Develop manually on feature branch
-
Commit Changes
-
Push and Create PR
-
Code Review
- Reviewers review PR
- Address feedback
-
Update PR with changes
-
Merge PR
- Merge after approval and passing CI/CD
- Delete feature branch after merge
Bug Fix Workflow¶
Steps:
-
Create Feature Branch
-
Fix Bug
- Fix the bug
-
Add test to prevent regression
-
Commit and PR
-
Review and Merge
- Review PR
- Merge after approval
Hotfix Workflow¶
Steps:
-
Create Hotfix Branch
-
Fix and Test
- Fix the issue
- Test thoroughly
-
Add tests
-
Merge to Main
-
Merge to Develop (if exists)
-
Delete Branch
Release Branching (If Used)¶
Release Process¶
Steps:
-
Create Release Branch
-
Version Bump
- Update version numbers
- Update changelog
-
Commit changes
-
Final Testing
- Run full test suite
- Manual testing
-
Fix any issues
-
Merge to Main
-
Merge to Develop (if exists)
-
Delete Branch
Note: Most teams prefer tagging main directly instead of release branches.
Factory-Generated Branches¶
Factory Branch Naming¶
Format: factory/feature-description or factory/run-{runId}
Examples:
- factory/invoice-service-generation
- factory/run-12345
- factory/update-billing-service
Factory Branch Workflow¶
How Factory Uses Branches:
- Factory Creates Branch - Factory creates feature branch for generation
- Generates Code - Factory commits generated code to branch
- Creates PR - Factory creates PR automatically
- Human Review - Human engineers review PR
- Merge - Human merges PR after approval
Working with Factory Branches:
- Don't modify directly - Don't commit to Factory branches manually
- Create new branch - Create your own branch from Factory branch if you need to modify
- Merge Factory branch - Merge Factory branch into your branch, then create PR
Example:
# Factory creates: factory/invoice-service-generation
# You need to add custom logic:
git checkout factory/invoice-service-generation
git checkout -b feature/invoice-service-with-custom-logic
# Add your custom code
git commit -m "Add custom invoice calculation"
git push origin feature/invoice-service-with-custom-logic
# Create PR from your branch
Tip
When Factory generates a branch, create your own branch from it if you need to add custom code. Don't commit directly to Factory branches—this makes it hard to regenerate from Factory later.
Related Documents¶
- Development Workflow - End-to-end development workflow
- CI/CD Guidelines - How CI/CD works with branches
- Testing Strategy - Testing practices