Skip to content

Git

Git

https://ohshitgit.com/

Hooks

https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
https://githooks.com/

Client-Side Hooks:
- pre-commit:
- prepare-commit-msg:
- commit-msg

Pre Commits

Pre Commit Hook:

cat > .git/hooks/pre-commit<< EOF
#!/bin/sh

if git grep --cached -q 'TODO'; then
    echo 'Your commit contains TODO comments. Resolve them before committing.'
    exit 1
fi
EOF

chmod +x .git/hooks/pre-commit

Per Repo Configs

https://www.benji.dog/articles/git-config/