Git hooks are scripts that run automatically every time a particular event occurs in a Git repository (e.g. $ git commit, $ git push, etc.).
By default, every Git repo has a .git/hooks directory (a hidden folder).
Change pre-commit.sample file name to pre-commit (by removing .sample). If you'd like to enable another hook, apply the same change to it.
In order to run the following script properly, you will need to install jq: https://stedolan.github.io/jq/download/
Copy-past the following code into your pre-commit file:
Make a change in a Kubernetes yaml file and make a commit. The bash script will look for all the yaml files that have been committed and will run datree test [yaml file] on each of them.