Always get the last commit message
Expected Behavior
Get the current commit message instead of the last one
Current Behavior
Get the last commit message
Affected packages
- [ ] cli
- [ ] core
- [ ] prompt
- [ ] config-angular
Possible Solution
Steps to Reproduce (for bugs)
- First step
- Second step
commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'ci',
'feat',
'fix',
'docs',
'style',
'refactor',
'test',
'chore',
'revert',
'upgrade',
'revert',
'build',
],
],
},
};
Context
Your Environment
| Executable | Version |
|---|---|
commitlint --version |
@commitlint/[email protected] |
git --version |
git version 2.37.1.windows.1 |
node --version |
v16.17.0 |
IDE:
WebStorm 2022.2.2
Build #WS-222.4167.31, built on September 14, 2022
Licensed to Mao Qingxin
Subscription is active until March 28, 2023.
For educational use only.
Runtime version: 17.0.4+7-b469.53 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2016M
Cores: 12
Registry:
ide.windowSystem.autoShowProcessPopup=true
Non-Bundled Plugins:
ski.chrzanow.foldableprojectview (1.1.3)
commit-template-idea-plugin (1.2.0)
mobi.hsz.idea.gitignore (4.4.2)
com.mallowigi (73.0.0)
ru.adelf.idea.dotenv (2022.2)
``
Where do you use commitlint? In the IDE or in the terminal? Does it work in the terminal?
Can you add some example info with git history where it can be seen that it's using the wrong message?
Hello, I had a similar problem. After setting up commitlint with husky I tried to commit with an invalid message to test the hook and then tried to commit with a valid message but I got the same error. Tried on vscode and the terminal but the error was always the same.
$ /home/joan/code/my_project/node_modules/.bin/commitlint --edit
â§— input: alsdkjf
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
I could solve it by deleteing the .git/COMMIT_EDITMSG file of the repo an creating it again touch .git/COMMIT_EDITMSG
Where do you use commitlint? In the IDE or in the terminal? Does it work in the terminal? Can you add some example info with git history where it can be seen that it's using the wrong message?
yeah, i Use the git-commit-template plugin under Webstorm
Once it fails, it will never succeed unless git hooks are turned off
Hello, I had a similar problem. After setting up commitlint with husky I tried to commit with an invalid message to test the hook and then tried to commit with a valid message but I got the same error. Tried on vscode and the terminal but the error was always the same.
$ /home/joan/code/my_project/node_modules/.bin/commitlint --edit ⧗ input: alsdkjf ✖ subject may not be empty [subject-empty] ✖ type may not be empty [type-empty] ✖ found 2 problems, 0 warnings ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlintI could solve it by deleteing the
.git/COMMIT_EDITMSGfile of the repo an creating it againtouch .git/COMMIT_EDITMSG
the same issue.
I found the solution: we should execute the command "npx --no-commitlint --edit ${1}" at the commit-msg hook instead of the pre-commit hook. This way, commitlint can take the current commit message from the COMMIT_EDITMSG file.
# .husky/commit-msg
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit ${1}
any progress for this ?