-
-
Notifications
You must be signed in to change notification settings - Fork 301
feat(commit): add --write-message-to-file option #731
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
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@ ## master #731 +/- ## ========================================== - Coverage 97.38% 97.35% -0.04% ========================================== Files 42 42 Lines 2029 2041 +12 ========================================== + Hits 1976 1987 +11 - Misses 53 54 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Great work! 💪🏻 thanks!
i noticed that it's not possible to use the --retry
option with this workflow. if another hook aborts the commit after running git commit
for example, the message generated with commitizen is lost. i would like to propose a follow-up issue in which the retry behavior can be configured as a default and a new --no-retry
flag is added to override the configuration.
The --no-retry
would be a breaking change, I'd rather keep the API. The --retry
has been requested a lot, so I imagine a lot of people are already using it, and I'd rather avoid changing it.
Is it not possible to run other checks and then the commit?
Is there a way to refactor the code in a non-breaking change?
But let's open another issue and discuss it there.
this would not be a breaking change if it can be configured and isn't be enabled by default. i'll open an issue for it and describe the feature in a backward compatible manner.
i had to remove the hook i was using because i added it on accident but otherwise i think this can be merged, right?
never mind, i couldn't stand the way the hook worked before so i made the following changes:
- have two separate hooks (
prepare-commit-msg
andpost-commit
) that can be downloaded from this repo - the hooks are written in python (which is actually more cross-compatible than bash)
- the hooks check if commitizen is even installed
- it's possible to make commits using commitizen using both
git commit
andcz commit
- the hooks have a similar retry feature to the one that commitizen has and they're interoperable so that
cz commit --retry
can be used to retry the last commit made viagit commit
and vice versa - the tutorial now contains an installation guide and a feature overview
That's nice! Thanks for taking the time to build this. I'll take a look at it tomorrow
Uh oh!
There was an error while loading. Please reload this page.
Description
This pull request resolves #689 by implementing my proposal for it.
Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
See #689 (comment).
Steps to Test This Pull Request
New option:
cz commit --write-message-to-file message.txt
in a Git repository with staged changes and complete interactive dialogmessage.txt
should be the generated commit messagecz commit
is unchangedGit hook:
docs/tutorials/auto_prepare_commit_message.md
in a Git repository with staged changesgit commit
orgit commit -m "..."
, the usualcz commit
interactive dialog runsAdditional context
These changes supersede #249 and #250.