A package that prevents AI slop by asking you questions about your code changes before allowing you to commit
Project description
Git Police
Git Police is a commit-time assistant designed to prevent low-quality or AI-slop code from being pushed. It challenges you with a senior-developer style question about your changes and only allows the commit when you demonstrate understanding of the code.
It supports both local models via Ollama and remote evaluation using Gemini.
Installation
Install inside your virtual environment
pip install git-police
Initialization
Run once inside a git repository
git-police init
This sets up the Git hook that triggers the code-understanding check before each commit.
To run global mode (Gemini only)
- Export your
GEMINI_API_KEY
export GEMINI_API_KEY="your_api_key"
- Run a commit with global mode enabled
GIT_POLICE_MODE=global git commit -m "msg"
To run a different Ollama model
By default, Git Police uses phi4-mini:latest. To use a different local model:
- Ensure you have ollama in your system
- pull the model you want to use
- Commit using the model
You can either use
GIT_POLICE_MODEL="your_model" git commit -m "msg"
To use the model
Or set it up once
export GIT_POLICE_MODEL="your_model"
and now you can commit as normal and it will use your specified model
Adjusting Maximum Characters Sent to the Local Model
If you want faster responses from your local model, you can reduce the number of characters sent:
MAX_CHAR=5000 GIT_POLICE_MODEL="your_model" git commit -m "msg"
Adjust MAX_CHAR as needed
Bypassing the Check (Emergency Commits)
If you encounter hallucinations or need to bypass Git Police temporarily:
git commit -m "your msg" --no-verify
Example
See git-police in action
Project details
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 git_police-0.1.6.tar.gz.
File metadata
- Download URL: git_police-0.1.6.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24fbc58131b3c50881ad930c8688707dc7cfd511823fc1f88ba7428c28fbb41d
|
|
| MD5 |
07f115ecea17aa135ce3a455522395ec
|
|
| BLAKE2b-256 |
d24683af3cc82bcb3c0aaef9454d49e3a1b5458385d79806eadb4971d2d9442a
|
File details
Details for the file git_police-0.1.6-py3-none-any.whl.
File metadata
- Download URL: git_police-0.1.6-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef45ccb17fabde47ddde85150655e01cf17916b1e78693421f208d2ad34f9db3
|
|
| MD5 |
68bdb4807be317a217fbf01027aef858
|
|
| BLAKE2b-256 |
9ff43aae003084865262ea4235c3d5cbdb3eb0e8a2ac77339c6bbc0f8b225aca
|