Skip to content

Getting started

Requirements

  • Python 3.13 or newer on PATH (the script starts with #!/usr/bin/env python3)
  • A Git working tree (client-side hooks)

The multiplexer is one file. There is nothing to pip install and no package to import.

Install as a Git hook

Copy src/multiplexer into .git/hooks under the hook name you want:

cp /path/to/git-hooks-multiplexer/src/multiplexer .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

The same file can be copied (or symlinked) as pre-merge-commit, commit-msg, pre-push, and any other supported hook. The installed name is the hook type.

cp /path/to/git-hooks-multiplexer/src/multiplexer .git/hooks/pre-merge-commit
cp /path/to/git-hooks-multiplexer/src/multiplexer .git/hooks/commit-msg
chmod +x .git/hooks/pre-merge-commit .git/hooks/commit-msg

A symlink is also fine if you keep a clone of this repo on disk:

ln -s /path/to/git-hooks-multiplexer/src/multiplexer .git/hooks/pre-commit

Add subhooks

Create executables under hooks/<type>/ at the repository root (not inside .git/hooks):

mkdir -p hooks/pre-commit
# add 01-lint, 02-confirm_default_branch, …
chmod +x hooks/pre-commit/*

Git then runs .git/hooks/pre-commit, which runs those files in alphabetic order.

First check

.git/hooks/pre-commit

If hooks/pre-commit/ is missing or empty, the multiplexer exits 0 and Git continues.

Developing this repository

The steps below are only for changing the multiplexer itself. The hook is the single file src/multiplexer.

git clone https://github.com/lupaxa-git-hooks-toolbox/git-hooks-multiplexer.git
cd git-hooks-multiplexer
python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
make init
make check