Files
Newzy Developer 0b72ae162b docs(building): document branching strategy and workflow
- Add comprehensive BUILDING.md with branch strategy
- Document feature/bugfix/hotfix workflows
- Provide merge vs rebase guidelines
- Include common git commands reference
2026-10-30 10:19:38 +00:00

4.3 KiB

newzy Building System

Git Branching Strategy

We follow a standard Git workflow with the following branches:

Main Branches

  • main - Production-ready code, stable releases

    • Contains only production-ready, tested code
    • Deployed to production environment
    • Protected branch requiring pull request approval
  • develop - Integration branch for feature development

    • Primary integration branch for all features and enhancements
    • Should be in a deployable state at all times
    • Merged into main before release (feature releases)

Feature Branches

  • feature/<name> - New features and enhancements
    • All new work should happen in feature branches
    • Create from develop branch
    • Follow naming convention: feature/short-description
    • Example: feature/user-authentication, feature/article-search

Bugfix Branches

  • bugfix/<name> - Bug fixes from develop
    • Used for bug fixes found in the develop branch
    • Create from develop branch
    • Follow naming convention: bugfix/short-description
    • Example: bugfix/login-page-layout, bugfix/comment-not-saving

Hotfix Branches

  • hotfix/<name> - Critical fixes from main
    • Used for urgent production bug fixes
    • Create directly from main branch
    • Merge hotfix to both main and develop after completion

Release Branches (Optional)

  • release/vX.Y.Z - Preparation for release
    • Final preparations before deployment to production
    • Bug fixes and final testing only

Git Workflow Guidelines

When to Use Each Branch

Scenario Source Branch Target Branch(es)
New feature develop develop → main
Bug in develop develop develop
Production bug fix main main → develop
Minor enhancements develop develop → main

Pull Request Process

  1. Create a feature branch from the appropriate source branch
  2. Make your changes and ensure all tests pass
  3. Update documentation if necessary
  4. Submit a pull request to the target branch
  5. Request review from team members
  6. Address feedback and make required changes
  7. Merge to target branch after approval

Merge vs Rebase

  • Preferred for integrating feature branches into develop
  • Maintains clear history of when features were integrated
  • Simple, linear merge process
# Merge a feature branch into develop
git checkout develop
git pull origin develop
git merge <feature-branch> --no-edit  # or use merge message
git push origin develop

When to Rebase

  • Rebasing recommended when:
    • Maintainer rebasing feature branches before merging
    • Cleaning up local branches with git rebase -i
# Interactive rebase for history cleanup
git checkout <feature-branch>
git rebase -i develop
git push origin --force-with-lease <feature-branch>

# Merge after rebase
git checkout develop
git merge <feature-branch>
git push origin develop

Pull Request Guidelines

Title Format:

<type>(<scope>): <subject>

<body>

<footer>

Types:

  • feat: - New feature
  • fix: - Bug fix
  • docs: - Documentation changes
  • style: - Formatting changes
  • refactor: - Code refactoring
  • perf: - Performance improvements
  • test: - Test additions/changes
  • chore: - Maintenance tasks

Example:

feat(auth): implement OAuth2 authentication

- Add Google OAuth provider integration
- Implement refresh token handling
- Update login page with social login options

Closes #42

Code Review Process

  1. Self-review: Ensure code quality before submitting PR
  2. Team review: At least one other team member must review
  3. Automated checks: All CI/CD checks must pass
  4. Approval: Required approval from maintainer(s)
  5. Merge: Squash merge or rebase merge as appropriate

Common Git Commands

# Clone repository
git clone <repository-url>

# Create and checkout feature branch
git checkout -b feature/my-feature develop

# Commit with conventional commits
git add .
git commit -m "feat(auth): implement OAuth2 authentication"

# Push to origin
git push origin feature/my-feature

# Update local develop branch
git checkout develop
git pull origin develop --rebase

# Merge feature into develop
git merge <feature-branch>

Last updated: $(date +%Y-%m-%d)