QamoosTech
Git & CollaborationIntermediate

Git Hook

Pronunciationgit hook

Definition

A script that Git runs automatically at a point in its workflow, such as before a commit or after a push, to check or prepare the work.

Where you hear it

In projects that run linters or tests before code is committed, and in team setup guides.

Examples

  • The git hook stops the commit if the linter fails.
  • Hooks live in the .git/hooks folder and are not shared by default.
  • The pre-commit hook runs the formatter, so unformatted code never reaches the repository.

Common mistake

Relying on a local hook as the only check. Anyone can skip it with --no-verify, so run the same checks in CI.

Don't confuse with

A git hook runs on one developer's machine. A CI check runs on the server for every change.