-
-
Notifications
You must be signed in to change notification settings - Fork 282
Is there any way to use this in a prepare-commit-msg hook? #689
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
Comments
I'm ok with this feature. The question is, should we refactor |
I think keeping The This way people can use it for more than just I could try whipping up an implementation of this if that helps. |
Sounds good, PR is welcome. |
I did some research and interactive pre-commit hooks are not a thing pre-commit/pre-commit#1857. A working #!/bin/sh
COMMIT_MSG_FILE=$1
exec < /dev/tty && cz commit --dry-run --write-message-to-file $COMMIT_MSG_FILE || true I'll add a tutorial to the docs as well. |
I opened a pull request. Would be awesome to see this getting released soon. |
Description
The Node version of commitizen provides a
--hook
flag that allows users to generate a commit message, without actually performing a commit, is there a way to replicate this behavior in the Python version?The example
prepare-commit-hook
in the cz-cli documentation is something like this:Possible Solution
A new command or flag such as
cz message
orcz commit --message-only
that could be embedded into a git hook that would generate a commit message without performing a full commit.Additional context
Since the commit message in
cz --dry-run
is output to stdout (along with the questions) there's no way to just pipe the output of that directly into.git/COMMIT_MSG
Additional context
No response
The text was updated successfully, but these errors were encountered: