Git hooks એ સ્ક્રિપ્ટ્સ છે જે Git આપોઆપ Git વર્કફ્લોના અમુક બિંદુઓ પર ચલાવે છે (commits, pushes, merges, વગેરે પહેલા/પછી). તે automation સક્ષમ બનાવે છે — standards લાગુ કરવા, checks ચલાવવા, અને actions ટ્રિગર કરવા — અને 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
