Git hooks ऐसे scripts हैं जिन्हें Git Git workflow के कुछ बिंदुओं पर स्वचालित रूप से चलाता है (commits, pushes, merges, आदि से पहले/बाद)। ये automation को सक्षम करते हैं — standards को लागू करना, checks चलाना, और actions को trigger करना — और code quality तथा CI integration के लिए व्यापक रूप से उपयोग किए जाते हैं।
Hooks क्या हैं
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
