Skip to main content
Practice Problems

What are Git hooks?

bash
# .git/hooks/pre-commit #!/bin/sh npm run lint npm run test # If fails, commit is aborted

With Husky:

json
{ "husky": { "hooks": { "pre-commit": "npm run lint", "pre-push": "npm test" } } }

Common hooks:

  • pre-commit
  • pre-push
  • post-merge
  • commit-msg

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.

Finished reading?
Practice Problems