最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Husky 5 .huskey gitignore - Stack Overflow

programmeradmin1浏览0评论

10 days ago, Husky 5 was released

after migrating to it (/)

I've noticed that there is a new .husky dir in the project.

by default it contains the following:

.huskey
   -> .gitignore
   -> /_

the .gitignore file is simply ignoring the _ dir

_

and inside the /_ dir there is a huskey.sh file which is obviously meant to be ignored.

in the documentation - you add hook by:

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

which will create a pre-commit file inside the .husky dir.

Should I commit that dir with the pre-commit file? not sure about that and can't find that in documentation.

10 days ago, Husky 5 was released https://dev.to/typicode/what-s-new-in-husky-5-32g5

after migrating to it (https://typicode.github.io/husky/#/)

I've noticed that there is a new .husky dir in the project.

by default it contains the following:

.huskey
   -> .gitignore
   -> /_

the .gitignore file is simply ignoring the _ dir

_

and inside the /_ dir there is a huskey.sh file which is obviously meant to be ignored.

in the documentation - you add hook by:

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

which will create a pre-commit file inside the .husky dir.

Should I commit that dir with the pre-commit file? not sure about that and can't find that in documentation.

Share Improve this question edited Feb 15, 2021 at 12:28 ET-CS asked Feb 15, 2021 at 12:17 ET-CSET-CS 7,1709 gold badges47 silver badges76 bronze badges 1
  • You should commit not-auto created files. If you always need to add that file, then commit. But usually you do not commit any dir that contains . prefix. – Justinas Commented Feb 15, 2021 at 12:31
Add a comment  | 

1 Answer 1

Reset to default 17

If you want those hooks to be standard for your repo then yes you will need to commit them. For example, if you have a commit-msg hook to lint commit messages and you want other developers cloning your repo to adhere to those lint rules then the commit-msg file is the way to enforce that.

发布评论

评论列表(0)

  1. 暂无评论