# Git Hooks **Hooks** are scripts that run automatically when git events occur, such as before committing or after merging. Common hooks include `pre-commit` (run before creating a commit), `post-merge` (run after merging), and `commit-msg` (validate the commit message). Store hooks in `.git/hooks/` and make them executable with `chmod +x`. Hooks are powerful for enforcing team standards: a pre-commit hook can run tests or a linter and refuse the commit if checks fail, a commit-msg hook can validate that messages follow your format, or a post-merge hook can remind you to reinstall dependencies after pulling. Each hook is a shell script that exits with status 0 to allow the action or non-zero to block it. ```bash $ ls -la .git/hooks/ # view available hooks $ cat .git/hooks/pre-commit # view a hook's contents $ chmod +x .git/hooks/pre-commit # make a hook executable ``` Hooks are stored locally in `.git/hooks/`, so they are not shared with your remote or team—each person must install their own copy. Many projects store hook scripts in a directory like `.githooks/` and configure git to use them with `git config core.hooksPath .githooks`, making it easier to share. Hooks run without your input, so keep them fast and ensure error messages are clear.