Git hooks explained

Git hooks are shell scripts that trigger when you perform a specific action in Git. They are useful tools for automating checks as you move through your general workflow.

You can trigger Git hooks around specific Git actions. For example, you can set up a Git hook that prevents you from committing if the hook script detects a problem.

Git hooks exist as simple text files in your .git/hooks directory.

If you just initialized a repo, there will be a .git folder in your repo with some of the sample Git hooks under the hooks folder. If you do not see this folder, you will need to first make sure you can see hidden folders on your operating system.

Git hooks tutorial video

Watch this short video to learn more about Git hooks. At the end, we’ll show you how Git hooks work in GitKraken.