-
Notifications
You must be signed in to change notification settings - Fork 111
Description
While evalulating the use of gitlint I was pretty impressed by the configurability and ease of creating your own linting rules. Thanks a lot for creating and maintaining this tool!
When testing an actual commit workflow noticed that any commit messages rejected due to linting violations will get lost though:
gitlintis configured ascommit-msghook viapre-commitas described at https://jorisroovers.com/gitlint/latest/commit_hooks/#pre-commit- A commit message template is defined via
git config --global commit.template ~/.gittemplate - I issue a new commit via
git commitwhich opens my configured editor prepopulated with the template and I am free to author my commit message - Upon saving and closing the editor,
gitlintwill spring to life and check the previously authored commit message against my configured rules
a. In case there is no vilations, all is good. The commit is completed and done.
b. In case of linting violationsgitlintrejects and git aborts the commit as expected
Case 4b. is now the challenging one because gitlint will nicely print all my violations, however once I start a second attempt to commit again via git commit with the plan to correct my commit message all previously authored content is gone and I see the blank template again.
This problem is also discussed in pre-commit/pre-commit#833 with some suggestions to address this but no production grade solution given.
Before diving deeper into working on a pull request to implement a solution like discussed in the referenced issue, I wanted to check here if am simply missing something? What does a typical workflow with gitlint as commit-msg hook look like that does not expose the problem described above?
Thanks for helping me on understanding this :)