Install and run Git hooks
Install the prek pre-commit hook for the bare repository and run every hook on demand.
On this page
Check formatting, linting, and spelling on every commit to the dotfiles.
Prerequisites
prekonPATH, or mise to install the locked version.
The installer installs the hook automatically when either is available.
Install the hook
With mise:
mise run --cd ~/.config/dotfiles install:git-hooks
Without mise:
cd ~/.config/dotfiles && sh mise-tasks/install/git-hooks.sh
Rerun either command to repair a hook.
Run every hook
Set GIT_DIR and GIT_WORK_TREE; prek cannot find the bare repository from $HOME on its own:
cd ~ && GIT_DIR="$HOME/.local/share/dotfiles" GIT_WORK_TREE="$HOME" \
prek run --config .config/dotfiles/prek.toml --all-files
Fixers such as typos, end-of-file-fixer, and ryl rewrite files in place; review dotfiles diff afterwards.
Verify
sh ~/.config/dotfiles/mise-tasks/doctor.sh
The Bare-repo hook configuration check passes.
It fails when the hook lacks the bare-repository overrides; reinstall the hook to fix it.