Conventions
Conventional Commits
Section titled “Conventional Commits”Standardized commit message format for clear and meaningful version control history.
Format
Section titled “Format”<type>[optional scope]: <description>
[optional body]
[optional footer(s)]Standard Commit Types
Section titled “Standard Commit Types”Core Types (from Conventional Commits spec):
feat- New feature for the userfix- Bug fix for the userdocs- Documentation only changesstyle- Code style changes (formatting, white-space, semicolons, etc.)refactor- Code change that neither fixes a bug nor adds a featureperf- Code change that improves performancetest- Adding missing tests or correcting existing testsbuild- Changes that affect the build system or external dependenciesci- Changes to CI configuration files and scriptschore- Other changes that don’t modify src or test files
Extended Commit Types
Section titled “Extended Commit Types”Additional Types for comprehensive project management:
wip- Work in progress (avoid in main branches)deps- Dependency updates (alternative tochore(deps))revert- Reverts a previous commitmerge- Merge commits (when not using fast-forward)release- Release/version bump commitssecurity- Security fixes or improvementsi18n- Internationalization and localizationa11y- Accessibility improvements
Scopes
Section titled “Scopes”Scopes provide additional contextual information about what part of the codebase is affected.
Common Scope Patterns:
feat(api): add user endpointfix(auth): resolve token expirationdocs(readme): update installation stepsstyle(button): adjust paddingrefactor(utils): simplify date formattingperf(images): implement lazy loadingtest(auth): add login flow testsbuild(vite): update configurationci(github): add test workflowchore(deps): update dependenciesScope Guidelines:
✅ Use consistent, descriptive scopes
✅ Keep scopes short (single word or hyphenated)
✅ Use lowercase
✅ Group related changes under same scope
✅ Common scopes: api, ui, auth, db, cli, config
❌ Don’t use overly generic scopes (misc, other, stuff)
❌ Don’t use file names as scopes (use feature/module instead)
❌ Don’t mix multiple unrelated scopes in one commit
Breaking Changes
Section titled “Breaking Changes”Breaking changes MUST be indicated in the commit message.
Method 1: Add ! after type/scope
feat!: remove deprecated API endpointsfeat(api)!: change response formatMethod 2: Add BREAKING CHANGE: footer
feat(api): improve error handling
BREAKING CHANGE: Error responses now return RFC 7807 format instead of custom format.Migration guide: https://docs.example.com/migration/v2Multi-line Commit Messages
Section titled “Multi-line Commit Messages”Use the body to explain what and why, not how.
Structure:
<type>[scope]: <short description>
<blank line>
<detailed explanation of the change>- Why the change was necessary- What problem it solves- Any side effects or considerations
<blank line>
<footer(s)>Example:
fix(auth): prevent token refresh race condition
Users were experiencing intermittent authentication failures whenmultiple API calls triggered simultaneous token refresh attempts.
This fix implements a mutex lock to ensure only one token refreshcan occur at a time, with other requests waiting for the result.
- Added token refresh queue- Implemented exponential backoff for retries- Added unit tests for concurrent scenarios
Fixes: #234Refs: #189Commit Footers
Section titled “Commit Footers”Footers provide additional metadata and references.
Common Footers:
Issue References:
Fixes: #123Closes: #456, #789Resolves: #234Refs: #567Related: #890Co-authorship:
Co-authored-by: Jane Doe <jane@example.com>Co-authored-by: John Smith <john@example.com>Review and Approval:
Reviewed-by: Alice Johnson <alice@example.com>Approved-by: Bob Wilson <bob@example.com>Signed-off-by: Developer Name <dev@example.com>Breaking Changes:
BREAKING CHANGE: Description of the breaking change and migration pathOther Metadata:
See-also: #123Depends-on: #456Ticket: JIRA-123PR: #789Detailed Examples
Section titled “Detailed Examples”Simple Feature:
feat(dashboard): add user activity chartFeature with Scope and Details:
feat(analytics): add real-time visitor tracking
Implemented WebSocket-based real-time analytics dashboard thatdisplays current visitors, page views, and user actions.
- Added WebSocket server endpoint- Created real-time chart component- Implemented connection recovery logic
Closes: #123Bug Fix with Breaking Change:
fix(api)!: correct user permissions logic
Previous implementation incorrectly granted admin permissions toregular users under certain conditions. This fix enforces properpermission checking but requires clients to update theirauthentication flow.
BREAKING CHANGE: Authentication tokens now include explicit permissionclaims. Clients must verify these claims before showing admin UI.
Migration guide: /docs/migration/v3-auth.md
Fixes: #456Security: CVE-2025-1234Performance Improvement:
perf(images): implement progressive image loading
Replaced immediate full-resolution image loading with progressiveenhancement strategy:
1. Show blur placeholder immediately2. Load low-resolution preview3. Load full resolution when in viewport
Results:- 60% faster initial page load- 40% reduction in bandwidth for above-fold content- Improved Lighthouse performance score from 78 to 94
Refs: #789Dependency Update:
deps: update astro to v4.2.0
Updated Astro framework to latest version for security patchesand performance improvements.
Notable changes:- Fixed View Transitions memory leak- Improved dev server startup time- Added new experimental features
Full changelog: https://github.com/withastro/astro/releases/v4.2.0
Closes: #234Refactoring:
refactor(auth): migrate to OAuth 2.1
Modernized authentication system to use OAuth 2.1 specification,removing deprecated grant types and improving security posture.
Changes:- Removed implicit grant flow- Implemented PKCE for all flows- Updated token refresh mechanism- Migrated from JWT to opaque tokens
No user-facing changes, fully backward compatible.
Refs: #567Internationalization:
i18n: add Japanese translations
Added complete Japanese translation for the application including:- UI strings- Error messages- Email templates- Documentation
Translated by: Yuki Tanaka <yuki@example.com>Reviewed-by: Hiro Sato <hiro@example.com>
Closes: #890Security Fix:
security(auth): fix JWT signature verification bypass
Critical security fix for JWT validation vulnerability that couldallow attackers to bypass authentication.
Impact: HighCVSS Score: 8.1Affected versions: < 2.3.5
Details: https://security.example.com/advisories/2025-001
Fixes: #999Security: CVE-2025-5678Revert:
revert: feat(api): add rate limiting
This reverts commit abc123def456.
Reverting due to performance issues in production. The rate limitingimplementation caused 30% increase in response times under load.
Will re-implement with improved caching strategy.
Refs: #1001Best Practices
Section titled “Best Practices”Do’s:
✅ Write commits in imperative mood (“add feature” not “added feature”) ✅ Keep subject line under 72 characters ✅ Use body to explain what and why, not how ✅ Separate subject from body with blank line ✅ Use bullet points in body for multiple changes ✅ Reference issues and PRs in footer ✅ Make atomic commits (one logical change per commit) ✅ Use breaking change indicators for incompatible changes
Don’ts:
❌ Don’t use vague descriptions (“fix stuff”, “update things”)
❌ Don’t combine unrelated changes in one commit
❌ Don’t use generic types (chore for everything)
❌ Don’t skip the description
❌ Don’t include file names in subject (use scope instead)
❌ Don’t use past tense (“fixed bug” → “fix bug”)
❌ Don’t end subject line with period
Commit Granularity
Section titled “Commit Granularity”Too Small (avoid):
fix: typofix: another typofix: one more typo→ Should be: fix(docs): correct typos in API documentation
Too Large (avoid):
feat: complete redesign and new features→ Should be split into multiple commits, each with specific changes
Just Right:
feat(ui): add dark mode togglefix(auth): resolve session timeout issuerefactor(api): simplify error handlingTooling and Automation
Section titled “Tooling and Automation”Commitizen
Section titled “Commitizen”Interactive CLI tool for writing standardized commit messages.
Installation:
bun add -D commitizen cz-conventional-changelogConfiguration (package.json):
{ "scripts": { "commit": "cz" }, "config": { "commitizen": { "path": "cz-conventional-changelog" } }}Usage:
git add .bun run commitCommitizen will prompt you through:
- Select type
- Enter scope (optional)
- Write short description
- Write longer description (optional)
- List breaking changes (optional)
- Reference issues (optional)
commitlint
Section titled “commitlint”Validates commit messages against conventional commit format.
Installation:
bun add -D @commitlint/cli @commitlint/config-conventionalConfiguration (commitlint.config.js):
export default { extends: ['@commitlint/config-conventional'], rules: { 'type-enum': [ 2, 'always', [ 'feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'build', 'ci', 'chore', 'revert', 'wip', 'deps', 'release', 'security', 'i18n', 'a11y' ] ], 'subject-case': [2, 'always', 'lower-case'], 'subject-max-length': [2, 'always', 72], 'body-max-line-length': [2, 'always', 100] }};Usage:
echo "feat: add feature" | bunx commitlintGit hooks to enforce commit conventions.
Installation:
bun add -D huskybunx husky initSetup commit-msg hook:
echo "bunx commitlint --edit \$1" > .husky/commit-msgchmod +x .husky/commit-msgNow every commit will be validated automatically.
standard-version
Section titled “standard-version”Automated versioning and CHANGELOG generation.
Installation:
bun add -D standard-versionConfiguration (package.json):
{ "scripts": { "release": "standard-version", "release:minor": "standard-version --release-as minor", "release:major": "standard-version --release-as major" }}Usage:
bun run release # Auto-detect version bumpbun run release:minor # Force minor version bumpbun run release:major # Force major version bumpAutomatically:
- Determines version bump from commits
- Updates version in package.json
- Generates/updates CHANGELOG.md
- Creates git tag
- Commits changes
semantic-release
Section titled “semantic-release”Fully automated version management and package publishing.
Installation:
bun add -D semantic-release @semantic-release/changelog @semantic-release/gitConfiguration (.releaserc.json):
{ "branches": ["main"], "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/changelog", "@semantic-release/npm", "@semantic-release/git", "@semantic-release/github" ]}CI Integration (GitHub Actions):
name: Releaseon: push: branches: [main]
jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 - run: bun install - run: bunx semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}conventional-changelog
Section titled “conventional-changelog”Generate changelogs from commit messages.
Installation:
bun add -D conventional-changelog-cliConfiguration (package.json):
{ "scripts": { "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", "changelog:all": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0" }}Usage:
bun run changelog # Update changelog with latest changesbun run changelog:all # Regenerate entire changelogIDE Integration
Section titled “IDE Integration”VS Code
Section titled “VS Code”Extension: Conventional Commits
Settings (.vscode/settings.json):
{ "conventionalCommits.autoCommit": false, "conventionalCommits.scopes": [ "api", "ui", "auth", "db", "cli", "config" ], "conventionalCommits.showEditor": true}JetBrains IDEs
Section titled “JetBrains IDEs”Plugin: Conventional Commit
Configure custom types and scopes in plugin settings.
References
Section titled “References”Conventional Branch
Section titled “Conventional Branch”Git branch naming conventions for organized workflow and clear intent.
Format
Section titled “Format”<type>/<description><type>/<scope>-<description><type>/<ticket>-<description><type>/<ticket>-<scope>-<description>Standard Branch Types
Section titled “Standard Branch Types”Permanent Branches:
main- Primary production-ready branchmaster- Alternative name for primary branch (usemainpreferred)develop- Integration branch for features (Git Flow)staging- Pre-production testing branch
Temporary Branches:
feature/orfeat/- New functionalitybugfix/orfix/- Bug fixes for developmenthotfix/- Critical production fixesrelease/- Release preparationchore/- Maintenance tasksdocs/- Documentation only changesrefactor/- Code refactoringperf/- Performance improvementstest/- Test additions or updatesbuild/- Build system changesci/- CI/CD pipeline changesstyle/- Code style changes
Extended Branch Types
Section titled “Extended Branch Types”Additional Types for comprehensive workflows:
experiment/- Experimental features or proof of conceptsspike/- Research or investigation taskswip/- Work in progress (not ready for review)security/- Security fixes or improvementsdeps/- Dependency updatesrevert/- Reverting previous changesmigration/- Data or code migrationsi18n/- Internationalization worka11y/- Accessibility improvements
Branch Naming Conventions
Section titled “Branch Naming Conventions”Character Rules:
✅ Use lowercase letters (a-z) ✅ Use numbers (0-9) ✅ Use hyphens (-) to separate words ✅ Use forward slash (/) to separate type from description
❌ Avoid spaces ❌ Avoid special characters (@, #, $, %, etc.) ❌ Avoid consecutive hyphens or slashes ❌ Avoid leading/trailing punctuation ❌ Avoid uppercase letters (unless part of ticket ID)
Description Guidelines:
✅ Be descriptive yet concise ✅ Use present tense (“add” not “added”) ✅ Separate words with hyphens ✅ Keep total branch name under 50-60 characters ✅ Include ticket/issue numbers when relevant
❌ Don’t use vague descriptions (“fix-bug”, “update”) ❌ Don’t include commit hashes ❌ Don’t use developer names ❌ Don’t duplicate type in description
Ticket Integration
Section titled “Ticket Integration”With Issue Numbers:
feature/123-user-authenticationfix/456-login-timeouthotfix/789-security-patchWith Ticket Systems:
feature/JIRA-123-add-dashboardfix/GH-456-api-errorhotfix/SEC-789-xss-vulnerabilityGrouped by Scope:
feature/auth-social-loginfeature/auth-two-factorfix/ui-button-spacingfix/ui-modal-overflowBranch Patterns
Section titled “Branch Patterns”Simple Pattern
Section titled “Simple Pattern”<type>/<description>Examples:
feature/dark-modefix/header-alignmentdocs/api-referencechore/dependenciesWith Scope
Section titled “With Scope”<type>/<scope>-<description>Examples:
feature/auth-login-pagefix/api-timeout-handlingrefactor/ui-button-componentperf/db-query-optimizationWith Ticket
Section titled “With Ticket”<type>/<ticket>-<description>Examples:
feature/123-user-dashboardfix/456-memory-leakhotfix/789-security-patchWith Ticket and Scope
Section titled “With Ticket and Scope”<type>/<ticket>-<scope>-<description>Examples:
feature/123-auth-oauth-integrationfix/456-api-rate-limitingrefactor/789-db-connection-poolNumbered Branches
Section titled “Numbered Branches”For sequential or parallel work:
<type>/<description>-<number><type>/<description>-v<version>Examples:
experiment/new-architecture-1experiment/new-architecture-2feature/payment-gateway-v1feature/payment-gateway-v2spike/performance-investigation-1Branch Lifecycle
Section titled “Branch Lifecycle”Creating Branches
Section titled “Creating Branches”From main/develop:
# Feature branchgit checkout -b feature/user-profile main
# Bugfix from developgit checkout -b fix/login-error develop
# Hotfix from main (production)git checkout -b hotfix/critical-security-fix mainNaming Based on Origin:
- Features/bugs → from
developormain - Hotfixes → always from
main(production) - Release branches → from
develop
Updating Branches
Section titled “Updating Branches”Keep branch updated with base:
# Update from maingit checkout feature/my-featuregit pull origin main --rebase
# Or merge if preferredgit merge mainFrequency:
- Update daily for long-running branches
- Update before creating PR
- Update after resolving conflicts
Merging Branches
Section titled “Merging Branches”Feature/Bugfix → develop/main:
# Via Pull Request (recommended)gh pr create --base main --head feature/my-feature
# Direct merge (if permitted)git checkout maingit merge --no-ff feature/my-featuregit push origin mainHotfix → main and develop:
# Merge to main firstgit checkout maingit merge --no-ff hotfix/security-fixgit tag -a v1.2.3 -m "Security fix"git push origin main --tags
# Then backport to developgit checkout developgit merge --no-ff hotfix/security-fixgit push origin developDeleting Branches
Section titled “Deleting Branches”After successful merge:
# Delete local branchgit branch -d feature/my-feature
# Delete remote branchgit push origin --delete feature/my-feature
# Or via GitHub CLIgh pr merge 123 --delete-branchBulk cleanup:
# Delete all merged branchesgit branch --merged | grep -v "\*\|main\|develop" | xargs -n 1 git branch -d
# Delete remote tracking branches that no longer existgit fetch --pruneReal-World Examples
Section titled “Real-World Examples”E-commerce Application
Section titled “E-commerce Application”feature/cart-add-to-cartfeature/cart-checkout-flowfeature/payment-stripe-integrationfix/product-image-loadingfix/cart-quantity-validationhotfix/payment-processing-errorrelease/v2.0.0chore/update-dependenciesdocs/api-endpointsSaaS Platform
Section titled “SaaS Platform”feature/auth-sso-samlfeature/billing-subscription-managementfeature/analytics-dashboardfix/auth-token-expirationfix/billing-invoice-generationhotfix/database-connection-poolrefactor/api-error-handlingperf/query-optimizationsecurity/implement-rate-limitingContent Management System
Section titled “Content Management System”feature/editor-rich-textfeature/media-libraryfeature/user-roles-permissionsfix/editor-autosavefix/media-upload-validationi18n/add-french-translationa11y/keyboard-navigationmigration/v1-to-v2-contentOpen Source Project
Section titled “Open Source Project”feature/123-plugin-systemfeature/456-theme-customizationfix/789-memory-leakfix/1011-broken-linksdocs/contributing-guidelinesdocs/installation-guideci/github-actions-workflowtest/integration-testsBranch Strategies
Section titled “Branch Strategies”Git Flow
Section titled “Git Flow”main (production)├── develop (integration)│ ├── feature/user-auth│ ├── feature/dashboard│ └── bugfix/api-error├── release/v1.2.0└── hotfix/security-patchBranch Flow:
- Features:
develop→feature/*→develop - Releases:
develop→release/*→main+develop - Hotfixes:
main→hotfix/*→main+develop
GitHub Flow
Section titled “GitHub Flow”main (production)├── feature/user-profile├── feature/notifications├── fix/login-issue└── hotfix/critical-bugBranch Flow:
- All branches from
main - All branches back to
main - Deploy from
main
GitLab Flow
Section titled “GitLab Flow”main (production)├── pre-production│ ├── feature/new-ui│ └── fix/api-timeout└── stagingBranch Flow:
- Features:
main→feature/*→staging→pre-production→main - Environment branches are long-lived
Best Practices
Section titled “Best Practices”Do’s:
✅ Create branches from latest main/develop ✅ Use descriptive, meaningful names ✅ Include ticket numbers when available ✅ Keep branches short-lived (days, not months) ✅ Update frequently from base branch ✅ Delete branches after merging ✅ Use consistent naming across team ✅ Follow team conventions strictly
Don’ts:
❌ Don’t work directly on main/develop ❌ Don’t create branches from feature branches (unless necessary) ❌ Don’t use personal names in branches ❌ Don’t let branches diverge too far from base ❌ Don’t reuse old branch names ❌ Don’t keep stale branches indefinitely ❌ Don’t use ambiguous names
Anti-Patterns
Section titled “Anti-Patterns”Vague Names:
❌ fix/bug❌ feature/new-stuff❌ update/things❌ temp❌ wipToo Long:
❌ feature/implement-user-authentication-with-oauth2-and-jwt-tokens-and-refresh-token-rotation→ Better: feature/oauth2-authentication
Wrong Type:
❌ feature/fix-login-bug # Should be fix/❌ fix/add-new-feature # Should be feature/❌ chore/critical-security # Should be hotfix/ or security/Personal Branches:
❌ john/working-on-auth❌ dev-team-refactor❌ my-changesReused Names:
❌ Reusing feature/user-auth after it was already merged→ Better: feature/user-auth-improvements or feature/user-auth-v2
Automation and Tooling
Section titled “Automation and Tooling”Branch Protection Rules
Section titled “Branch Protection Rules”GitHub Settings:
main: - Require pull request reviews (2 approvals) - Require status checks to pass - Require branches to be up to date - Require conversation resolution - Do not allow bypassing settings - Restrict pushes to specific users/teamsConfiguration:
# Via GitHub CLIgh api repos/:owner/:repo/branches/main/protection \ --method PUT \ --field required_pull_request_reviews='{"required_approving_review_count":2}' \ --field enforce_admins=trueGit Aliases
Section titled “Git Aliases”Useful aliases (~/.gitconfig):
[alias] # Create feature branch feat = "!f() { git checkout -b feature/$1 main; }; f"
# Create fix branch fix = "!f() { git checkout -b fix/$1 develop; }; f"
# Create hotfix branch hotfix = "!f() { git checkout -b hotfix/$1 main; }; f"
# Update branch from main update = "!git pull origin main --rebase"
# List branches by date branches = "!git branch --sort=-committerdate"
# Delete merged branches cleanup = "!git branch --merged | grep -v '\\*\\|main\\|develop' | xargs -n 1 git branch -d"Usage:
git feat user-authenticationgit fix login-timeoutgit hotfix security-patchgit updategit cleanupBranch Naming Validation
Section titled “Branch Naming Validation”Pre-push hook (.git/hooks/pre-push):
#!/usr/bin/env bash
current_branch=$(git symbolic-ref --short HEAD)
# Allow permanent branchesif [[ "$current_branch" =~ ^(main|master|develop|staging)$ ]]; then exit 0fi
# Validate branch name formatif ! [[ "$current_branch" =~ ^(feature|feat|fix|bugfix|hotfix|release|chore|docs|refactor|perf|test|build|ci|style|experiment|spike|wip|security|deps|revert|migration|i18n|a11y)/[a-z0-9-]+$ ]]; then echo "❌ Invalid branch name: $current_branch" echo "" echo "Branch names must follow the pattern:" echo " <type>/<description>" echo "" echo "Valid types:" echo " feature, fix, hotfix, release, chore, docs, refactor," echo " perf, test, build, ci, style, experiment, spike, etc." echo "" echo "Example: feature/user-authentication" exit 1fi
exit 0Make executable:
chmod +x .git/hooks/pre-pushGitHub Actions Integration
Section titled “GitHub Actions Integration”Branch naming check (.github/workflows/branch-naming.yml):
name: Branch Naming
on: pull_request: types: [opened, synchronize, reopened]
jobs: check-branch-name: runs-on: ubuntu-latest steps: - name: Check branch name run: | BRANCH="${{ github.head_ref }}"
if [[ ! "$BRANCH" =~ ^(feature|feat|fix|bugfix|hotfix|release|chore|docs|refactor|perf|test|build|ci|style)/[a-z0-9-]+$ ]]; then echo "❌ Invalid branch name: $BRANCH" echo "Branch names must follow: <type>/<description>" exit 1 fi
echo "✅ Branch name is valid: $BRANCH"References
Section titled “References”Semantic Versioning (SemVer)
Section titled “Semantic Versioning (SemVer)”Version numbering system that conveys meaning about changes in each release.
Format: MAJOR.MINOR.PATCH[-PRERELEASE][+BUILD]
Version Increments:
- MAJOR (1.0.0) - Incompatible API changes, breaking changes
- MINOR (0.1.0) - New features, backward-compatible additions
- PATCH (0.0.1) - Bug fixes, backward-compatible fixes
Pre-release versions:
1.0.0-alpha- Alpha release1.0.0-beta- Beta release1.0.0-rc.1- Release candidate
Examples:
0.1.0 - Initial development1.0.0 - First stable release1.1.0 - New features added1.1.1 - Bug fixes2.0.0 - Breaking changesReference: semver.org
Keep a Changelog
Section titled “Keep a Changelog”Structured changelog format for documenting all notable changes in a project.
Principles:
- Changelogs are for humans, not machines
- One entry per version
- Group changes by type
- Latest version first
- Release dates included
Change Types:
Added- New featuresChanged- Changes to existing functionalityDeprecated- Soon-to-be removed featuresRemoved- Removed featuresFixed- Bug fixesSecurity- Security vulnerability fixes
Example Format:
## [1.0.0] - 2025-01-15
### Added- User authentication system- Dashboard analytics
### Fixed- Login timeout issue- API response caching
### Changed- Updated UI design systemReference: keepachangelog.com
Code Style
Section titled “Code Style”Consistent code formatting and conventions for maintainable codebases.
Style Guides:
Tools:
- Prettier - Code formatting
- ESLint - Code linting and style enforcement