Skip to content

typicode/husky

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Having a pre-commit the previous documentation failed with

```shell
$ git commit
.husky/pre-commit: 9: /home/user/.huskyrc: [[: not found
```

Using this patch is compatible with /bin/bash
9d3eb31

Git stats

Files

Permalink
Failed to load latest commit information.

husky

Open Collective Node.js CI

Modern native Git hooks made easy

Husky improves your commits and more ๐Ÿถ woof!

Install

npm install husky -D

Usage

Edit package.json > prepare script and run it once:

npm pkg set scripts.prepare="husky install"
npm run prepare

Add a hook:

npx husky add .husky/pre-commit "npm test"
git add .husky/pre-commit

Make a commit:

git commit -m "Keep calm and commit"
# `npm test` will run every time you commit

For more use cases (project in sub-directory, custom directory, CI support, ...), see documentation.

Documentation

https://typicode.github.io/husky

Important Upgrading from v4 to v8 requires migrating previous config, please see the docs.

Articles

License

MIT

Sponsors

Companies

Does your company use husky? Ask your manager or marketing team if your company would be interested in supporting this project.

Individuals

Find husky helpful? Become a backer and show your appreciation with a monthly donation on Open Collective. You can also tip with a one-time donation.

GitHub sponsors can be viewed on my profile. All past and current Open Collective sponsors can be viewed on here.