Skip to content
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

Husky throws away my commit message if it doesn't like it #13952

Closed
cincodenada opened this issue Jan 15, 2022 · 2 comments
Closed

Husky throws away my commit message if it doesn't like it #13952

cincodenada opened this issue Jan 15, 2022 · 2 comments
Labels
type: refactor For issues and PRs. Things that improve the code readability, maintainability, testability, etc.

Comments

@cincodenada
Copy link
Contributor

cincodenada commented Jan 15, 2022

Issue Creation Checklist

[x] I have read the contribution guidelines

Bug Description

I'm all for good commit messages, and in fact consider myself a champion of them. But if I write a commit message that commitlint doesn't like, Husky gives me an error and then throws away my commit message, with no guidance about how to proceed, other than the validation errors. This is extremely frustrating!

As someone who writes detailed, useful commit messages using an editor, it's a very offputting experience (and very much against the spirit of git) to write a nice useful paragraph in the commit body, and then have it vanish into the ether because I didn't prefix my subject correctly or some such. This is doubly so because this is most likely to happen to new contributors who are not deeply familiar with git and don't know where their commit message went!

This may better be filed as an upstream bug with Husky (which I also plan to do also), but if a project is implementing aggressive commit linting around particular commit formatting (which, properly implemented, is fine!), I think it's incumbent on them to do it in a way that isn't destructive. I'm all for enforcing a correct style, just not for throwing away someone's commit message because they made a typo.

After some research I found that the commit message isn't actually gone, and if you don't make another commit you can recover it with some cumbersome commands, but I doubt most git users are aware it is even a possibility, much less how to do it. This project should offer a better way.

What do you expect to happen?

I wanted to be able to edit my paragraph-long commit message to conform to the guidelines

What is actually happening?

My commit message was discarded with no apparent way to recover it

Would you be willing to resolve this issue by submitting a Pull Request?

Did it, #13953 - it ain't pretty, but it's better than what we've got.

@fzn0x fzn0x closed this as completed Jan 15, 2022
@fzn0x fzn0x added the type: refactor For issues and PRs. Things that improve the code readability, maintainability, testability, etc. label Jan 15, 2022
@ephys
Copy link
Member

ephys commented Jan 15, 2022

Thank you :) Let us know if husky ever implements it upstream too

@cincodenada
Copy link
Contributor Author

Thank you :) Let us know if husky ever implements it upstream too

Will do! I still need to figure out where best some mitigation might fit upstream - it may be better placed with commitlint - but I do plan to see what I can get in place up there. Thanks for the quick merge on this end in the meantime!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: refactor For issues and PRs. Things that improve the code readability, maintainability, testability, etc.
Projects
None yet
Development

No branches or pull requests

3 participants