# Git Workflow and Branching Strategy This document outlines the git workflow, branching strategy, commit conventions, and code review guidelines for the glyphdiff.com project. ## Table of Contents 1. [Branching Strategy](#branching-strategy) 2. [Branch Naming Conventions](#branch-naming-conventions) 3. [Commit Message Conventions](#commit-message-conventions) 4. [Code Splitting and Merge Request Guidelines](#code-splitting-and-merge-request-guidelines) 5. [Branch Protection Rules](#branch-protection-rules) 6. [Git Hooks Configuration](#git-hooks-configuration) --- ## Branching Strategy We use a Gitflow-inspired branching strategy adapted for our development workflow. This strategy provides a clear structure for feature development, bug fixes, and releases. ### Branch Types #### 1. `main` Branch - **Purpose**: Production-ready code only - **Protection**: Highest level of protection - **Rules**: - Only merge `release/*` or `hotfix/*` branches into `main` - No direct commits allowed - Must pass all tests and code reviews - Tags are created from this branch for releases (e.g., `v1.0.0`) #### 2. `develop` Branch - **Purpose**: Integration branch for features - **Protection**: High level of protection - **Rules**: - Merge `feature/*` and `fix/*` branches into `develop` - No direct commits allowed - Must pass all tests before merging - Serves as the base for `release/*` branches #### 3. `feature/*` Branches - **Purpose**: Develop new features - **Naming**: `feature/feature-name` (e.g., `feature/font-catalog`, `feature/comparison-grid`) - **Base**: Always branch from `develop` - **Merge**: Merge back into `develop` via Merge Request (MR) - **Rules**: - One feature per branch - Keep branches focused and small - Delete after merging #### 4. `fix/*` Branches - **Purpose**: Fix bugs discovered during development - **Naming**: `fix/issue-description` (e.g., `fix/font-loading-error`, `fix/responsive-layout`) - **Base**: Branch from `develop` - **Merge**: Merge back into `develop` via MR - **Rules**: - One fix per branch - Include tests that verify the fix - Delete after merging #### 5. `hotfix/*` Branches - **Purpose**: Critical fixes for production issues - **Naming**: `hotfix/critical-fix` (e.g., `hotfix/security-patch`, `hotfix-production-crash`) - **Base**: Branch from `main` - **Merge**: Merge into both `main` and `develop` - **Rules**: - Use only for production emergencies - Must be thoroughly tested - Create a release tag after merging to `main` #### 6. `release/*` Branches - **Purpose**: Prepare for a new release - **Naming**: `release/vX.Y.Z` (e.g., `release/v1.0.0`, `release/v1.1.0`) - **Base**: Branch from `develop` - **Merge**: Merge into both `main` and `develop` - **Rules**: - Finalize release notes - Update version numbers - Perform final testing - Create release tag after merging to `main` ### Branch Workflow Diagram ``` main (production) ↑ │ hotfix/*, release/* │ develop (integration) ↑ │ feature/*, fix/* │ feature branches ``` --- ## Branch Naming Conventions ### Feature Branches - Format: `feature/feature-name` - Examples: - `feature/font-catalog` - `feature/comparison-grid` - `feature/dark-mode` - `feature/google-fonts-integration` ### Fix Branches - Format: `fix/issue-description` - Examples: - `fix/font-loading-error` - `fix/responsive-layout` - `fix/state-persistence` - `fix-accessibility-contrast` ### Hotfix Branches - Format: `hotfix/critical-fix` - Examples: - `hotfix/security-patch` - `hotfix-production-crash` - `hotfix-api-rate-limit` ### Release Branches - Format: `release/vX.Y.Z` - Examples: - `release/v1.0.0` - `release/v1.1.0` - `release/v2.0.0` ### Naming Guidelines - Use lowercase letters - Use hyphens to separate words - Be descriptive but concise - Avoid special characters (except hyphens) - Keep names under 50 characters --- ## Commit Message Conventions We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. This format enables automated changelog generation and better commit history readability. ### Format ``` ():