# 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/`** - 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/`** - 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/`** - 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 #### Recommended: Merge Commits - Preferred for integrating feature branches into `develop` - Maintains clear history of when features were integrated - Simple, linear merge process ```bash # Merge a feature branch into develop git checkout develop git pull origin develop git merge --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` ```bash # Interactive rebase for history cleanup git checkout git rebase -i develop git push origin --force-with-lease # Merge after rebase git checkout develop git merge git push origin develop ``` ### Pull Request Guidelines **Title Format:** ``` ():