-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Husky v6 - conflict between git hooks and husky hooks? #943
Comments
Did you review in the last comments? I think we had this bug migrating from 4 to 5 and the solution was deleting the |
I did not find anything mentioning that in the other issues, is that a thing? |
I just tested the following scenario and it did not help, # move the current settings so they are ignored
mv .husky/prepare-commit-msg .husky/prepare-commit-msg2
mv .git/hooks .git/hooks2
# create an empty .git/hooks folder
mkdir .git/hooks
# Reinitialize husky & gitmoji
npx husky-init
gitmoji -i
# ✔ Gitmoji commit hook created successfully But same status: |
@SalahAdDin As far as I can remember, since Husky5 it does relate anymore on |
Yes I'm aware that husky hooks should be moved to My issue is that, after migrating to husky v6, hooks setup directly inside |
Okay I think I understand now, running In my case, {
"scripts": {
"prepare": "husky install .git/hooks"
}
} But then all hooks (even husky ones) are unversioned, up to every contributor to set or not set those (also unsure if that works in Windows systems) Or I guess I could add Still, I felt husky v4 was naturally integrating with git hooks, where v6 is taking over the native git config and a way that I find too opinionated for me 😕 |
I guess I will close that one then, since it seems like the intended behavior of husky v6 |
The fact that Husky changes |
Context
I recently migrated from v4 to v6 and managed to get husky hooks working fine with the new config.
However, I had hooks setup from other tools (in my case, gitmoji), installed directly inside
.git/hooks/prepare-commit-msg
Before migrating
Using husky v4, I had the possibility to enforce hooks with husky:
And git hooks setup directly inside
.git/hooks
were running just fine as well.After migrating
Using husky v6, hooks setup inside
.git/hooks
seem to be ignored for some reason (cannot figure out why myself).The content of files in there has not changed, and when I reset
.git/hooks/prepare-commit-msg
usinggitmoji -r
thengitmoji -i
, I can see the file.git/hooks/prepare-commit-msg
being removed then re-created.If I install it as a husky hook inside
.husky/prepare-commit-msg
then it is active when runninggit commit
.BUT, my problem is that
.husky
is commited, and the hook would apply to anyone contributing in the project,where
.git/hooks
, which is not commited, allows for anyone to enable or disable specific hooks.A few questions then:
PS: I have not tested the edge-case of conflicting hooks defined both inside
.git/hooks
AND.husky
(same hook), but this is not really my case here (I would personally be fine with husky "taking over" in such case, to enforce a team's shared settings over user personal settings)The text was updated successfully, but these errors were encountered: