33 lines
936 B
Markdown
33 lines
936 B
Markdown
# Client-Side Git Hooks
|
|
|
|
To use one of these hooks, copy them from the respective directory to `.githooks/` in your repository and name according to the parent directory, then execute
|
|
```shell
|
|
git config core.hooksPath .githooks
|
|
```
|
|
|
|
It is recommended to then document when you made the copy so you can later propagate upstream changes, eg:
|
|
```shell
|
|
#!/bin/sh -euC
|
|
#
|
|
# Reject commit messages that do not conform to Conventional Commits.
|
|
#
|
|
# Enforces Conventional Commits v1.0.0 at the syntactic level.
|
|
# Also enforces a custom list of types.
|
|
#
|
|
# Upstream: gitea.bp99.eu/bp99/git-hooks
|
|
# Updated: 2026-07-15
|
|
|
|
# [... contents ...]
|
|
```
|
|
|
|
## Tricks
|
|
|
|
To avoid having to remember the `git` command, add a `Makefile` to your project with a `setup` target:
|
|
```makefile
|
|
setup:
|
|
git config core.hooksPath .githooks
|
|
|
|
.PHONY: setup
|
|
```
|
|
Do not forget to communicate to contributors that this `setup` target should be executed after cloning the repo.
|