Hooks Examples

Chester Wyke December 20, 2023 Updated: April 15, 2025 #git

Skip commit hooks

Source: https://stackoverflow.com/questions/7230820/skip-git-commit-hooks

Add a --no-verify flag. Only tested on commit as below

git commit --no-verify

pre-commit Hook to prevent changes to a zola project base_url

#!/bin/sh

# Check if we see the line with the base_url being changed
git diff --cached config.toml | grep "^-base_url"
if [ $? -eq 0 ]
then
    echo "Error: Change detected to base_url"
    exit 1
fi

zola_chrono pre-push hook

Link

Conventional Commit Checking

Simple (not robust) conventional commit checker. Instead of copying code here that may go out of date here is a link to one I have in use in a project. In that same folder are scripts to set it up if you don’t already know how to do it. If you are still running into issues please reach out via github issues (see link in footer).