Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: husky will replace existing hook #1407

Conversation

zayne-wang
Copy link

fix: fix the issue #1387

  • add file detection, when file exists, the new file will not be created.

@zayne-wang zayne-wang changed the title fix: husky will replace existing hook #1387 fix: husky will replace existing hook Mar 12, 2024
@typicode
Copy link
Owner

Thank you for the PR. Actually files in .husky/_/ are owned by husky and shouldn't be edited. That's why they get replaced.

User hooks needs to be in .husky/. For example, if you create .husky/pre-commit it won't be replaced.

@typicode typicode closed this Mar 12, 2024
@rdmark
Copy link

rdmark commented Apr 18, 2024

@typicode Thanks for an awesome tool!

User hooks needs to be in .husky/. For example, if you create .husky/pre-commit it won't be replaced.

This does not match what I'm seeing with husky 9.0.11. I have my own .husky/pre-commit file with custom commands. When I run npx husky init this file gets overwritten with the default npm test again.

I wonder if this is a bug, or some kind of misunderstanding?

@typicode
Copy link
Owner

typicode commented Apr 18, 2024

Thanks for the kind words :)

Some kind of misunderstanding. husky init is an automatic setup and should be run once (like npm init or git init for example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants