Git Hooks sind Skripte, die Git automatisch an bestimmten Punkten im Git-Workflow ausführt (vor/nach Commits, Pushes, Merges, usw.). Sie ermöglichen Automatisierung — Durchsetzung von Standards, Ausführung von Überprüfungen und Auslösung von Aktionen — und werden häufig für Codequalität und CI-Integration verwendet.
Was Hooks sind
Hooks are executable scripts in .git/hooks/ (or managed by tools) that Git runs on EVENTS:
CLIENT-SIDE (local):
pre-commit → before a commit is created (lint, format, run quick tests)
commit-msg → validate/format the commit message
pre-push → before pushing (run tests, prevent pushing broken code)
post-merge/checkout → after merge/checkout (e.g. reinstall dependencies)
SERVER-SIDE (on the remote):
pre-receive / update → enforce policies on push (reject bad pushes)
post-receive → trigger deployment/CI/notifications after a push
