Skip to content

GitHub Branch Structure

Main Branches

Main Branch

  • Contains stable and releasable version
  • No direct commits
  • Every commit must be production-ready
  • Version numbers marked with tags

Develop Branch

  • Main development branch
  • Feature branches are created from here
  • No direct commits
  • Completed features are merged here
  • Preparation branch for next release

Temporary Branches

Feature Branches

  • Format: feature/feature-name
  • Created for new features
  • Branched from develop
  • Merged back to develop when complete
  • Example: feature/login-system

Bugfix Branches

  • Format: bugfix/bug-description
  • Used for bug fixes
  • Branched from develop
  • Example: bugfix/login-error

Hotfix Branches

  • Format: hotfix/urgent-fix
  • For urgent production fixes
  • Branched from main
  • Merged to main and develop
  • Example: hotfix/security-patch

Release Branches

  • Format: release/x.y.z
  • Used for release preparation
  • Branched from develop
  • Merged to main and develop
  • Example: release/1.2.0

Branch Management Principles

Naming Conventions

  • Use lowercase letters
  • Words separated by hyphens (-)
  • Choose descriptive names
  • Use prefixes (feature/, bugfix/, etc.)

Merge Strategy

  • Use Pull Requests
  • Code review required
  • CI/CD tests must pass
  • Conflicts must be resolved

Documentation

  • Document branch purpose
  • Update CHANGELOG.md
  • Prepare release notes

Security

  • Protect main branch
  • Prevent direct pushes
  • Enforce code review
  • Apply branch protection rules

Best Practices

Branch Cleanup

  • Delete merged branches
  • Clean up old branches
  • Regular branch maintenance

Commit Messages

  • Descriptive commit messages
  • Use conventional commits
  • Reference issue numbers

Version Management

  • Use semantic versioning
  • Create release tags
  • Keep CHANGELOG updated