A CLI tool to quickly set up and check pre-commit Git hooks for Python, JS, and TS projects.
Project description
Quick Git Hooks
A CLI tool to quickly set up and manage pre-commit Git hooks for Python, JavaScript, and TypeScript projects.
Features
- 🚀 One-command setup of pre-commit hooks
- 🔍 Automatic detection of Python/JS/TS projects
- 📝 Comprehensive documentation and guides
- ✨ Pre-configured hooks for:
- Code formatting (black, prettier)
- Linting (flake8, eslint with flat config)
- Import sorting (isort)
- Commit message formatting (commitizen)
- Branch naming conventions
- 🔄 Easy hook management and customization
- 🛠️ Modern tooling support:
- ESLint flat config (eslint.config.js)
- Automatic tool installation
- Smart file ignoring (.prettierignore)
Installation
pip install quick-git-hooks
Quick Start
-
Navigate to your Git repository:
cd your-repository
-
Run the setup command:
quick-git-hooks setupThis will:
- Create
.pre-commit-config.yamlwith recommended hooks - Create
GIT_HOOKS_GUIDE.mdwith detailed documentation - For JS/TS projects:
- Create
eslint.config.jswith modern flat config - Install required tools globally (prettier, eslint)
- Create
- Install pre-commit hooks
- Install required Python tools
- Provide instructions for any missing dependencies
- Create
-
Check the setup status:
quick-git-hooks check -
Review
GIT_HOOKS_GUIDE.mdfor:- Pre-configured git hooks and their purpose
- Recommended branching strategy (Git Flow)
- How to customize hooks
- Common commands and troubleshooting
Commands
Setup
quick-git-hooks setup [--overwrite] # Set up hooks (--overwrite to replace existing config)
Check
quick-git-hooks check # Verify setup and dependencies
Run Hooks Manually
quick-git-hooks run hooks # Run all hooks on all files
Skip Hooks
git commit --no-verify # Skip pre-commit and commit-msg hooks
git push --no-verify # Skip pre-push hooks
Included Hooks
-
Code Quality
- black (Python formatting)
- flake8 (Python linting)
- isort (Python import sorting)
- prettier (JS/TS formatting)
- eslint (JS/TS linting with modern flat config)
-
Commit Quality
- commitizen (Conventional Commits)
- merge conflict detection
- trailing whitespace fixing
- end of file fixing
-
Branch Quality
- Branch naming convention enforcement
- Protected branch checks
See GIT_HOOKS_GUIDE.md for detailed configuration options.
Configuration Files
When JS/TS files are detected, the following files are automatically created:
eslint.config.js: Modern ESLint flat configuration with:- JavaScript and TypeScript support
- Recommended rules and best practices
- Customizable ignore patterns
- TypeScript-specific rules when needed
Development
-
Clone the repository:
git clone https://github.com/Eng-Elias/quick-git-hooks cd quick-git-hooks
-
Create and activate virtual environment:
python -m venv .venv # On Windows: .\.venv\Scripts\activate # On Unix: source .venv/bin/activate
-
Install development dependencies:
make install-dev -
Available make commands:
make install # Install package from local sources make install-dev # Install in editable mode with dev dependencies make build # Build package distribution make publish # Upload to PyPI (requires twine setup) make clean # Clean build artifacts
Requirements
- Python ≥ 3.7
- Git
- For Python hooks: black, flake8, isort
- For JS/TS hooks: Node.js, npm (for global installation of prettier and eslint)
- For commit messages: commitizen
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quick_git_hooks-0.1.0.tar.gz.
File metadata
- Download URL: quick_git_hooks-0.1.0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebd63d1dfd4a5004571af9f3373c8283801b2a062a0d512332bfe27f8523178b
|
|
| MD5 |
44ef82226c3c77c6e1dc2e2f6ab0982b
|
|
| BLAKE2b-256 |
f70af1ba0adadf753172a9fd91a7bce38d40bc6ecfaa38d5f1c1fde75a78c011
|
File details
Details for the file quick_git_hooks-0.1.0-py3-none-any.whl.
File metadata
- Download URL: quick_git_hooks-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b185ac0cdf545bebcb3409219199fdb200cd8cb85dc69e313c4a0741b74ef3c
|
|
| MD5 |
1a265c462cfea47f425b24c9d4e1cf61
|
|
| BLAKE2b-256 |
3c1f21ed7184269c5d77f2406c4caf074f260571e03144358374d11d72f74d45
|