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

Add option to keep some hooks after run npm uninstall simple-git-hooks #119

Open
chouchouji opened this issue Feb 22, 2025 · 4 comments · May be fixed by #121
Open

Add option to keep some hooks after run npm uninstall simple-git-hooks #119

chouchouji opened this issue Feb 22, 2025 · 4 comments · May be fixed by #121

Comments

@chouchouji
Copy link

chouchouji commented Feb 22, 2025

Question

I edited a commit-msg hook which used to improve my work experience. But when I run npm uninstall simple-git-hooks, it will remove all hooks. I have to add commit-msg file back.

Can we add an option to keep these useful hooks?

If you think so, I am pleased to submit a pr.

@JounQin
Copy link
Contributor

JounQin commented Mar 8, 2025

You can config "preserveUnused": ["commit-msg"] option before uninstallation.

@chouchouji
Copy link
Author

You can config "preserveUnused": ["commit-msg"] option before uninstallation.

It will delete all hooks, please check it in https://github.com/toplenboren/simple-git-hooks/blob/master/simple-git-hooks.js#L214

Image

@JounQin
Copy link
Contributor

JounQin commented Mar 9, 2025

Maybe we should align it with

} else if (!preserveUnused.includes(hook)) {
_removeHook(hook, projectRootPath)
}

@chouchouji
Copy link
Author

Maybe we should align it with

simple-git-hooks/simple-git-hooks.js

Lines 174 to 176 in 0433a04

} else if (!preserveUnused.includes(hook)) {
_removeHook(hook, projectRootPath)
}

Yeah. Maybe it is a bug. We should only remove some hooks that are not in preserveUnused.

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 a pull request may close this issue.

2 participants