LinuxCommandLibrary

husky

improves Git hooks management for JavaScript projects

TLDR

Initialize husky

$ npx husky init
copy
Add pre-commit hook
$ npx husky add .husky/pre-commit "npm test"
copy
Install hooks
$ npx husky install
copy
Set hook
$ npx husky set .husky/pre-push "npm run lint"
copy

SYNOPSIS

husky command [options]

DESCRIPTION

Husky improves Git hooks management for JavaScript projects. It enables running linters, tests, and other scripts on commit and push.
The tool simplifies hook configuration in package.json. It's widely used with lint-staged for pre-commit code quality checks.

PARAMETERS

COMMAND

Subcommand to run.
init
Initialize husky.
install
Install git hooks.
add FILE CMD
Add hook script.
set FILE CMD
Set hook content.
--help
Display help information.

CAVEATS

Node.js package. Requires npm/yarn. Version 5+ has different API.

HISTORY

Husky was created to simplify Git hook management in JavaScript projects, becoming a standard dev dependency.

SEE ALSO

lint-staged(1), git(1), npm(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community