Skip to content

Option to allow fixup! and squash! in commit messages #414

Closed
@lobotmcj

Description

@lobotmcj

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions