Option to allow `fixup!` and `squash!` in commit messages
See original GitHub issueDescription
It would be nice if cz check
didn’t fail for fixup and squash commits, e.g., git commit --fixup <rev>
or git commit --squash <rev>
if the commit messages are otherwise acceptable. In git worflows that use rebase and --autosquash
, the offending commit message portion (squash!
or fixup!
) will be removed. This is especially annoying when commitizen is used with pre-commit
, because every time you do a squash or fixup commit you have to SKIP=commitizen git commit --fixup ...
.
Possible Solution
Add a CLI option to cz check
for this such as --autosquash
or some better name which, if true, prepends the commit message check regex pattern with something like r"((fixup|squash)\!\s)?"
I haven’t thought through all of the use cases, but a CLI option may be preferable to a config setting in e.g., toml because you may want the behavior to be different when you are committing (allow) versus pushing or in your CI pipeline (deny). So having something that can be changed a bit more easily than a config option may be desirable. But I hold this opinion lightly.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:8 (7 by maintainers)
Top GitHub Comments
fine by me as well 👍
I don’t think this is related to git itself. It’s just a matter of allowing fixup commits in the regexp.
For example, having the commit-msg pre-commit hook installed, there should be a way to let this not fail: