Git Standards¶
This document outlines our Git workflow standards, commit conventions, and automation practices.
Overview¶
Our Git standards ensure:
- Consistent commit history
- Automated quality checks
- Clean development workflow
- Standardized PR process
Commit Message Standards¶
We use Conventional Commits specification with the following types:
Commit Types¶
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code changes that neither fix bugs nor add featuresperf: Performance improvementstest: Adding or updating testsbuild: Build system or dependency changesci: CI configuration changeschore: Other changes that don't modify src or test filesrevert: Reverting previous changessecurity: Security-related changes
Examples¶
| Bash | |
|---|---|
Branch Naming Convention¶
Format: <type>/<description>
Types¶
feature: New functionalitybugfix: Bug fixeshotfix: Urgent fixes for productionrelease: Release preparationchore: Maintenance tasksdocs: Documentation updatestest: Test-related changesci: CI/CD updatessecurity: Security-related changes
Examples¶
Git Hooks¶
We use Husky to manage Git hooks for automated checks.
Pre-commit Hook¶
Runs before each commit:
- Lint staged files
- Run tests
- Build verification
Commit-msg Hook¶
Validates commit messages:
- Conventional Commits format
- Type validation
- Description requirements
Pre-push Hook¶
Verifies before pushing:
- Branch naming
- Code quality checks
- Test coverage
Post-merge Hook¶
Runs after merging:
- Package updates check
- Dependency installation
- Clean-up tasks
Pull Request Process¶
- Create PR using template
- Fill required sections:
- Description
- Type of change
- Related issues
- Testing performed
- Checklist completion
PR Template Sections¶
| Markdown | |
|---|---|
Automation Scripts¶
Branch Name Verification¶
| JavaScript | |
|---|---|
Package Updates Check¶
| JavaScript | |
|---|---|
Post-checkout Cleanup¶
| JavaScript | |
|---|---|
Best Practices¶
- Commit Guidelines
- Write clear, concise messages
- Reference issues when applicable
-
Keep commits focused and atomic
-
Branch Management
- Regular rebasing with main
- Clean up merged branches
-
Protect main/master branch
-
Code Review
- Use PR templates
- Follow review checklist
- Provide constructive feedback
Tools and Configuration¶
- Commitlint
- Enforces commit message format
- Configurable rules
-
Integration with CI/CD
-
Husky
- Manages Git hooks
- Automated checks
-
Custom scripts
-
PR Templates
- Standardized format
- Required sections
- Checklist items