hookmaster
Project description
Hookmaster
Some nice git hooks for your pleasure.
Problem:
- You have a policy where every commit message should mention the jira ticket it applies to. You have them in the branch name, and can't be arsed to type them manually to each commit message. Hookmaster provides you with a nice "default" commit message formatter in prepare-commit-msg hook.
- You want to specify commands to run as different git hooks, in a file you share with your team in git.
Installation
uv tool install hookmaster
Usage
To add 'hookmaster' hooks to all projects under /my/path
hookmaster add /my/path
Now, you get a nice commit message hook that maps branch
/bugfixes/SOMETICKET-123-do-stuff
to
SOMETICKET-123: Do stuff
The hooks themselves relay the call to hookmaster, e.g. prepare-commit-msg hooks created by hookmaster looks like this:
#!/bin/sh
hookmaster prepare-commit-msg "$@"
This delegates the message creation to globally installed hookmaster application. This means fixes to hookmaster benefit all your repositories at once.
githooks.toml
For any other hooks, you can specify them in githooks.toml:
pre-commit = "python tasks.py format"
pre-post = "pytest"
# empty string does nothing in the hook
commit-msg = ""
The format should be obvious. The specified command will always be run in repository root.
The hook created by this will look like:
#!/bin/sh
hookmaster run pre-commit
The command hookmaster run will load the githooks.toml file, find the hook and run it.
You can use command hookmaster run pre-commit to test the hook without actually committing
anything.
Usig githooks.toml is optional, if you just want to get the commit message hook.
To easily initalize your repo with githooks.toml, run hookmaster init. It creates a sample
githooks.toml and initializes the hooks. Edit the githooks.toml file to customize
your hooks.
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 hookmaster-1.4.4.tar.gz.
File metadata
- Download URL: hookmaster-1.4.4.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9864f2ceb0c6073452fe0377a4d6b3dcabf9cbe4dd082a3c161a2f01f9e66d5
|
|
| MD5 |
6b508c209f2e21cf226ae4656a694d0b
|
|
| BLAKE2b-256 |
96f0828625cb557266cd3be835316abb2f26445c0d88f97df8503a3ee87d4ccb
|
File details
Details for the file hookmaster-1.4.4-py3-none-any.whl.
File metadata
- Download URL: hookmaster-1.4.4-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0051baafd6208b2a9a922dcaa43193d16065a326ecbb1d73e61ed4b05aa06aa7
|
|
| MD5 |
fe96655ea9c5a6dc3cb2df5f146d5c3c
|
|
| BLAKE2b-256 |
d51293d68d26ca7c5e59517ba2ce2a33257067110953df81077bf6a7a827b1e1
|