A centralized repository for commit message validation and management tools that can be used across multiple projects.
- Commit Message Validation: Ensures consistent commit message formatting across projects
- Dual Format Support: Supports both custom
[TYPE] - descriptionand conventional commits format - Pre-commit Integration: Easy integration with pre-commit framework
- Centralized Management: No need to copy scripts to individual projects
[TYPE] - description
Allowed Types:
ADD- Adding new features or functionalityCI- Continuous integration changesFEATURE- New feature implementationBUGFIX- Bug fixesFIX- General fixesINIT- Initial setup or initializationDOCS- Documentation changesTEST- Test-related changesREFACTOR- Code refactoringSTYLE- Code style changesCHORE- Maintenance tasks
Examples:
[ADD] - user authentication system
[FIX] - resolve database connection timeout
[DOCS] - update API documentation
type: description
type(scope): description
Allowed Types:
feat- New featuresfix- Bug fixesdocs- Documentation changesstyle- Code style changesrefactor- Code refactoringtest- Test changeschore- Maintenance tasksci- CI/CD changesbuild- Build system changesperf- Performance improvementsrevert- Revert changes
Examples:
feat: add user authentication system
fix(database): resolve connection timeout
docs: update API documentation
chore: update dependencies to latest versions
- Install pre-commit:
pip install pre-commit # or brew install pre-commit
-
Create or update
.pre-commit-config.yamlin your project root:repos: # Commit message validation from centralized repository - repo: https://github.com/Gosayram/commit-mgmt rev: main # Use specific version tag in production hooks: - id: commit-msg-format # Other hooks (optional examples) - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-json
-
Install the pre-commit hooks:
pre-commit install --hook-type commit-msg
-
Test the setup (optional):
pre-commit run --hook-stage commit-msg --all-files
For production environments, it's recommended to pin to specific versions:
repos:
- repo: https://github.com/Gosayram/commit-mgmt
rev: v1.0.2 # Use specific version tag
hooks:
- id: commit-msg-formatYou can test commit messages manually using the script:
# Clone this repository
git clone https://github.com/Gosayram/commit-mgmt.git
cd commit-mgmt
# Test a commit message
echo "[ADD] - new feature implementation" | ./scripts/check-commit-msg.sh /dev/stdin
# Test conventional commit format
echo "feat: add new feature implementation" | ./scripts/check-commit-msg.sh /dev/stdinTo test changes locally before pushing:
-
Create a test commit message file:
echo "[TEST] - testing commit validation" > test_commit.txt
-
Run the validation script:
./scripts/check-commit-msg.sh test_commit.txt
- Follow the commit message format defined in this repository
- Ensure all scripts are executable (
chmod +x) - Test changes locally before submitting pull requests
- Update documentation for any new features or changes
-
Permission Denied Error
chmod +x scripts/check-commit-msg.sh
-
Pre-commit Not Found
pip install pre-commit # or brew install pre-commit -
Hook Not Running
pre-commit install --hook-type commit-msg
-
Testing Hook Manually
pre-commit run commit-msg-format --hook-stage commit-msg
This project is licensed under the MIT License - see the LICENSE file for details.
This repository uses GitHub Actions to automatically create releases when changes are made to:
scripts/directory (commit message validation script).pre-commit-hooks.yamlfile
The release workflow automatically determines the next version based on commit messages:
- Major version (v1.0.0 → v2.0.0): Breaking changes (commits with
!orBREAKING CHANGE) - Minor version (v1.0.0 → v1.1.0): New features (
feat,feature,[ADD],[FEATURE]) - Patch version (v1.0.0 → v1.0.1): Bug fixes, documentation, and other changes
Each release includes:
- Automatically generated release notes with recent commits
- Installation instructions for the specific version
- Links to documentation and examples
- Setup Guide - Detailed setup instructions
- Changelog - Version history and changes
- Example Configuration - Ready-to-use pre-commit config
For issues, questions, or contributions, please open an issue in this repository.