Home > Enterprise >  How to identify if a git commit skipped pre-hook checks or not?
How to identify if a git commit skipped pre-hook checks or not?

Time:02-16

We have set of predefined pre-hooks which checks for code validation and runs commit message enforcers and some-other things, but people tend to skip this validations by running git commit -n.

Is there way to identify those commits which skipped pre-hooks ? Or can we add some metadata to each commit with pre-hooks passed or pre-hooks failed ?

Thanks,

CodePudding user response:

The only way to do this would be using a server side hook or in a CI job.

If you use the tool pre-commit, you can use this CI job template to automatically check pre-commit hooks and, optionally, automatically apply automatic fixes to the source branch from the CI job.

For GitHub.com users, there's also pre-commit.ci.

  • Related