talira

Native Git hooks for npm projects, in 2 kB with no dependencies

open sourceMITfree

Husky sets up Git hooks for JavaScript projects, so commit messages get linted, code gets formatted and tests run when someone commits or pushes. It uses Git's core.hooksPath and is installed through npm's prepare script, so every developer who installs the project gets the hooks. It's about 2 kB with no dependencies and runs in about a millisecond. It supports all 13 client-side Git hooks, branch-specific hooks, POSIX shell scripts for advanced cases, monorepos and nested projects, Git GUIs and Node version managers, on macOS, Linux and Windows, and can be turned off globally.

Problems it solves

  • run lint and tests before every commit in my JavaScript project
  • make sure everyone on the team gets the same Git hooks after npm install
  • lint commit messages before they are committed
  • stop people pushing code that fails the tests

Features

  • all 13 client-side Git hooks
  • 2 kB, no dependencies
  • uses Git core.hooksPath
  • installs through the npm prepare script
  • branch-specific hooks
  • monorepo and nested project support
  • works with Git GUIs and Node version managers

Alternatives

The same job

These do what Husky does.

  1. pre-commit A framework for managing and maintaining multi-language pre-commit hooks.
  2. Lefthook Fast and powerful Git hooks manager for any type of projects.

Compare Husky with the top 3