-
Notifications
You must be signed in to change notification settings - Fork 554
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
Wizard exits into vim/COMMIT_EDITMSG #934
Comments
In fact, it is very not recommended to add |
+1 on this. Currently the existing husky integration with a prepare-commit-msg hook is broken and exits to an editor screen. Not sure what you mean @Zhengqbbb, the point of using husky with commitizen is to enforce commitizen usage on all commits. |
Yep~ when u use |
Is there any solution for this problem? It's ridiculous to try to edit it every time. Otherwise, the package has no meaning. |
same here, looking for a fix on this annoying behaviour. |
Hi guys, I am the author of cz-git and this is the only solution to alias your git command.
git() {
local _cmd="$*"
if [ "$1" = "commit" ] && [ "${_cmd%%"--help"}" = "$_cmd" ]; then
shift 1; command git commit -m ''
else
command git "$@"
fi
} Maybe next month I'll write a post explaining why this is a problem and how to resolve, until then can follow this thread |
I fixed the issue on my side by using the solution provided here https://gist.github.com/webbertakken/c2b457d39224baf701c8de1589b61555#file-pre-commit-sh-L7 Now the wizard will exit and my commitlint will run immediately instead of entering COMMIT_EDITMSG. EDIT: August 9. |
Hi @Zhengqbbb, thanks for the above workaround. Have you written the mentioned post yet? Kind regards, |
🤩 I have been busy in the last half year, even weekends, but you reminded me that see my sharing, I will prepare it, and I will reply to you after posting the article. |
Got a dirty solution here (using husky) by stubbing the editor with
This will still produce the following message:
However, it does achieve the goal of not opening a Vim or VS Code when using |
@ArturMoczulski FYI, if you configure the @Zhengqbbb There must be a better way? Maybe making use of the |
@danielbayley git config core.editor cat
Can add project scripts (like pnpm's postinstall) to help other project collaborator // package.json
"scripts": {
"postinstall": "git config --local core.editor cat",
} |
Just to clarify what I think @danielbayley was getting at:
This should achieve the desired effect of commitizen fully taking over the You can also place the |
So what would happen when someone tries to run something like I don't think setting the default editor to cat is a sensible approach to resolving this issue. |
Hi,
Hoping for a bit of guidance,
I have setup this package following the instructions and have the wizard running. This uses husky and the
prepare-commit-message
hook runsexec < /dev/tty && npx --no-install git-cz --hook || true
.Then the
commit-msg
hook runsnpx --no -- commitlint --edit "\${1}"
to lint the commit message.Relevant package versions:
The trouble i'm facing is that every time i complete the wizard i'm dumped back into the vim in what looks like the
COMMIT_EDITMSG
git hook asking me to enter a commit message, and have to:q
to exit which is annoying. Linting then runs after this as expected.Steps to reproduce:
git commit -a
in terminalYes
to theconfirmCommit
message.:q
to exitIf i comment out the linting stage i do not enter the
COMMIT_EDITMSG
hook, so from what i can tell, this opens because the--edit
flag of Commitlint says:read last commit message from the specified file or fallbacks to ./.git/COMMIT_EDITMSG
so looking at my lint commandnpx --no -- commitlint --edit "\${1}"
- is the path/file not being passed correctly from cz to commitlint? Or is the git process thinking it also needs to launch?Thanks
The text was updated successfully, but these errors were encountered: