Incorrect Commit Message from Previous Commit
mostafa-rio opened this issue · comments
Steps to Reproduce
1. set a type-enum rule
2. try to commit and test the rule then you see the input is coming from the previous commit message
there is also a StackOverflow page related to this:
https://stackoverflow.com/questions/78731073/commitlint-with-husky-failing-due-to-incorrect-commit-message-from-previous-comm
Current Behavior
No response
Expected Behavior
It should use the current commit message
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
No response
Context
No response
commitlint --version
@commitlint/cli
git --version
2.45.2
node --version
20.14.0
Just to clarify. This only happens when type-enum is set?
I can say no since I directly commented out the type-enum rule just to check if it works with other rules but it failed to catch the current commit message.
My current workaround is to use commit-msg husky instead of pre-commit hook and it works just fine
Uhm, ok, but the docs are correct then, right?
Oh Yeah, it's saying to use commit-msg. This made me think Commitlint does not even handle the pre-commit hook and people shouldn't be using this hook
👍 In this case this can be closed?
Yeah, can be closed. But I think this has to be mentioned in the docs since most developers use pre-commit hook to run the Commitlint rules
You wanna add a hint to the docs?
Yeah, I'll try to create a PR for this ASAP