Minimum Commit Message Length
Is there a way to encourage(force) users to enter a commit message of at least X characters? excluding white space. I'm trying to stop commit messages that are just a blank space long or a couple of characters, instead encourage messages that have been thought about, that are at the开发者_C百科 very least X(50) characters.
Chris has your answer (why don't people make their answers proper answers?!). You can't meaningfully prevent them from committing bad messages, but you can refuse to accept them when they push them using a pretxnchangegroup
hook.
I think this is really a people problem rather than a software problem. If developers are committing without messages they clearly don't understand why commit messages are important. You need to make sure everyone understands that good commit messages are expected, and ideally you'd ensure this while doing code reviews
Having said that a minimum commit message pretxnchangegroup hook does have some benefit. It can prevent accidental commits with no message, and may provide a bit of a nudge to correct bad behaviour. But it really does need to be coupled with education on why you need good commit messages else you risk developers writing their own hooks (pretxncommit I think) that pad the commit message to overcome your minimum length rule.
精彩评论