Skip to content

Before You Commit

Michael Jalkio edited this page Jan 2, 2019 · 1 revision

Git Hooks

Git hooks allow custom scripts to be triggered by specific git actions. By default, they are stored in the .git/hooks directory. Because the .git directory can not be checked into version control, some setup is required to use our hooks.

Setting up the hooks is valuable because it ensures that your changes will pass the repo's tests.

Requirements

In addition to the Installation requirements, you must install yamllint.

Installation

Installation is a single command that should be run from the repo directory ./bin/install-git-hooks.bash.

This will create symlinks in .git/hooks for all files in git-hooks. That means that if a new file is added to this directory, you must install again. But if a file is updated, the update will be effective as a hook immediately.

If you have existing hooks that are also defined in .git/hooks, they will be overwritten. Existing hooks that are not defined in git-hooks will not be removed.