Reputation: 2673
I see GIT provides a pre-commit and a commit-message hook...which is great...but I find it annoying that when I do a commit I have to wait for all my files to get linted and all my tests to run BEFORE I get told "sorry, you don't have JIRA-XXX in our commit message".
From what I read on the docs you can't change this order and the pre-commit hook doesn't have access to the commit message which hasn't been created yet.
is anybody else annoyed by this? If so, what are others doing?
Upvotes: 12
Views: 2919
Reputation: 7332
You are totally right when you say the order cannot be changed. And hopefully IMO, otherwise it would be a total mess.
Concerning your issue, even if this is not semantically appropriate, I think the best solution would be to rely on the commit-msg hook to perform all the checks (the commit message syntax and your linting, in this order).
Also, since version 1.8.2, git enables to add a pre-push hook. Which you might also consider in your workflow.
Upvotes: 6