toplenboren / simple-git-hooks

A simple git hooks manager for small projects
MIT License
1.32k stars 43 forks source link

removed hooks are not deleted #39

Closed JounQin closed 3 years ago

JounQin commented 3 years ago

I see commit-msg hook is supported, but I tried like following and failed:

module.exports = {
  'pre-commit': 'npx lint-staged',
  'commit-msg': 'npx commitlint -e', // it will work
}
JounQin commented 3 years ago

It seems that npx simple-git-hooks will not unset removed hooks...

I added prepare-commit-msg before and remove it then.

I can only remove .git/hooks/prepare-commit-msg manually as a workaround for now.

toplenboren commented 3 years ago

Thanks for the issue!

Yep, npx simple-git-hooks just gets the config, then adds / updates hooks. It does not handle the situation when you remove one hook and add another in config.

We can only remove all hooks when we uninstall the project

Adding this functionality is a good idea.

JounQin commented 3 years ago

Shall we call removeHooks() before https://github.com/toplenboren/simple-git-hooks/blob/master/cli.js#L10?

I'll raise a PR for it.