Open
Description
Expected Behavior
- You run
git commit
command in the command line. - Your editor (set by
EDITOR
) opens to allow you to enter the commit message. - You enter the message, save changes and quit the editor.
commitlint
validates the message.- Depending on the validation:
- If the message validated successfully, the commit was made and you're back in the command line
- If the message didn't pass the validation,
commitlint
asks you if you want to retry editing the message:- If you say yes, the editor is re-opened with the original message, allowing you to edit it and try again.
- If you say no, you're back in the command line with the editor state lost.
The proposed behavior in point 5 could be enabled/disabled using a configuration option.
Current Behavior
Steps 1-4 are the same as in Expected behavior; only step 5 is different:
- You run
git commit
command in the command line. - Your editor (set by
EDITOR
) opens to allow you to enter the commit message. - You enter the message, save changes and quit the editor.
commitlint
validates the message.- You are back in the command line no matter if the validation passed:
- If the message validated successfully, the commit was made
- If the message didn't pass the validation, the commit wasn't made and the editor state was lost (though the message was printed). You need to manually copy the message, re-run
git commit
and paste it in the commit message editor again (to be able to make that commit and to not need to write the message from the scratch again).
Affected packages
I don't know.
Possible Solution
I don't know.
Context
It's a bit irritating to need to re-run git commit
copying the message, every time you make some error and the message won't pass the validation.
I know I could pass the message with a -m
flag, which would make this problem less frustrating, but I find using the editor much more convenient, especially that on many occasions I write more than one paragraph in my commit messages.
Your Environment
Executable | Version |
---|---|
commitlint --version |
9.1.2 |
git --version |
2.28.0 |
node --version |
14.12.0 |