Branching Strategy

We follow a modified GitFlow workflow that emphasizes simplicity and continuous delivery.

Main Branches

main Branch

  • Production-ready code
  • Protected branch
  • Requires pull request and review
  • Tagged with version numbers
  • Automated deployments to production

develop Branch

  • Integration branch
  • Latest development changes
  • Automated deployments to staging
  • CI runs all tests

Feature Development

Feature Branches

# Create feature branch
git checkout develop
git checkout -b feature/payment-method-wave
 
# Keep updated with develop
git fetch origin
git rebase origin/develop
 
# Push changes
git push origin feature/payment-method-wave

Bug Fix Branches

# Create bug fix branch
git checkout develop
git checkout -b fix/transaction-timeout
 
# After testing
git push origin fix/transaction-timeout

Release Process

Release Branches

# Create release branch
git checkout develop
git checkout -b release/1.2.0
 
# Version bump and final testing
npm version minor
git push origin release/1.2.0

Hotfix Branches

# Create hotfix branch
git checkout main
git checkout -b hotfix/1.2.1
 
# Fix critical bug
npm version patch
git push origin hotfix/1.2.1

Branch Protection Rules

  1. main Branch

    • Require pull request reviews
    • Require status checks to pass
    • No direct pushes
    • Linear history (rebase merging)
  2. develop Branch

    • Require status checks to pass
    • Allow rebase merging
    • Automated test suite must pass

Merge Strategy

  1. Feature to Develop

    git checkout develop
    git pull origin develop
    git merge --no-ff feature/payment-method-wave
    git push origin develop
  2. Release to Main

    git checkout main
    git pull origin main
    git merge --no-ff release/1.2.0
    git tag -a v1.2.0 -m "Version 1.2.0"
    git push origin main --tags

Best Practices

  1. Branch Naming

    • feature/* - New features
    • fix/* - Bug fixes
    • release/* - Release preparation
    • hotfix/* - Emergency fixes
    • Use descriptive names
  2. Commit Messages

    # Format
    <type>(<scope>): <description>
     
    # Examples
    feat(payments): add Wave payment method
    fix(webhooks): handle timeout errors
    docs(api): update authentication guide
  3. Code Review

    • Create detailed pull requests
    • Add relevant labels
    • Link related issues
    • Request specific reviewers

Next Steps