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

Incorrect Commit Message from Previous Commit #4108

Closed
4 tasks
mostafa-rio opened this issue Jul 28, 2024 · 8 comments · Fixed by #4111
Closed
4 tasks

Incorrect Commit Message from Previous Commit #4108

mostafa-rio opened this issue Jul 28, 2024 · 8 comments · Fixed by #4111
Labels

Comments

@mostafa-rio
Copy link
Contributor

mostafa-rio commented Jul 28, 2024

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

@escapedcat
Copy link
Member

Just to clarify. This only happens when type-enum is set?

@mostafa-rio
Copy link
Contributor Author

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

@escapedcat
Copy link
Member

Uhm, ok, but the docs are correct then, right?

@mostafa-rio
Copy link
Contributor Author

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

@escapedcat
Copy link
Member

👍 In this case this can be closed?

@mostafa-rio
Copy link
Contributor Author

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

@escapedcat
Copy link
Member

You wanna add a hint to the docs?

@mostafa-rio
Copy link
Contributor Author

Yeah, I'll try to create a PR for this ASAP

mostafa-rio added a commit to mostafa-rio/commitlint that referenced this issue Aug 2, 2024
@mostafa-rio mostafa-rio mentioned this issue Aug 2, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants