typicode / husky

Git hooks made easy 🐶 woof!
https://typicode.github.io/husky
MIT License
32.55k stars 1.03k forks source link

Is the `.husky` directory meant to be committed to SCM? #986

Closed l3ender closed 3 years ago

l3ender commented 3 years ago

I'm setting up husky v6 on a new repo, but am having trouble getting it to work as compared to our previous repos using v4.

I see the .husky directory is created when husky is installed, and if hooks are created they are added to this directory. We had been excluding the whole .husky directory from source control, but now I'm not sure if this is correct.

The issue is that when another person clones the repository and runs npm install, the hook we want to run does not get created in their local .husky directory.

I've created a simple repo to test with, which shows that the "precommit" hook in package.json is not created in .husky directory.

-> git clone git@github.com:l3ender/husky6-debug.git && cd husky6-debug
...

-> npm install

> husky6-debug@1.0.0 prepare /Users/ross/repos/husky6-debug
> husky install

husky - Git hooks installed
added 96 packages from 65 contributors and audited 96 packages in 4.381s

19 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Context Please describe your issue and provide some context:

Thank you!

typicode commented 3 years ago

Hi @l3ender,

Yes, it's meant to be committed. Here's an example: https://github.com/typicode/lowdb/tree/main/.husky

l3ender commented 3 years ago

That's what I was missing...thanks!