https://github.com/manvirheer/lefthook-templates
Lefthook templates to prevent bad commit messages
https://github.com/manvirheer/lefthook-templates
devops git github lefthook
Last synced: 2 months ago
JSON representation
Lefthook templates to prevent bad commit messages
- Host: GitHub
- URL: https://github.com/manvirheer/lefthook-templates
- Owner: manvirheer
- Created: 2025-09-28T03:03:27.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-28T03:22:01.000Z (9 months ago)
- Last Synced: 2025-10-24T03:39:56.002Z (8 months ago)
- Topics: devops, git, github, lefthook
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lefthook Templates
This repository contains templates and configurations for [Lefthook](https://github.com/evilmartians/lefthook) - a fast and powerful Git hooks manager.
## About
Lefthook is a Git hooks manager that allows you to manage Git hooks with ease. This repository provides reusable templates and configurations for common development workflows.
## Templates
### Complete Lefthook Setup
A comprehensive Lefthook configuration with installation script and validation hooks.
**Includes:**
- `lefthook.yml` - Main configuration with commit-msg and pre-push hooks
- `.lefthook/lefthook-installation.js` - Automatic installation script
- `.lefthook/commit-msg/validate-message.sh` - Commit format validation
- `.lefthook/commit-msg/no-merge-commit.sh` - Merge commit prevention
**Features:**
- Cross-platform compatible (Windows, macOS, Linux)
- Intelligent CI detection and skipping
- Custom commit message format validation
- Pre-push checks with build validation
- Colorized output
**Setup:**
1. Copy the entire `.lefthook/` directory and `lefthook.yml` to your project
2. Add to your `package.json`:
```json
{
"scripts": {
"postinstall": "node ./.lefthook/lefthook-installation.js"
},
"devDependencies": {
"lefthook": "^1.11.13"
}
}
```
3. Make scripts executable: `chmod +x .lefthook/commit-msg/*.sh`
4. Install dependencies: `yarn install`
**Customization:**
- Modify commit types in `validate-message.sh`
- Adjust build commands in `lefthook.yml` for your project
- Update CI detection in `lefthook-installation.js`
## Usage
Browse the templates above and copy the ones that fit your project needs. Each template is designed to be easily customizable and well-documented.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License.