> For the complete documentation index, see [llms.txt](https://yu-sun.gitbook.io/essential-git-for-scientists/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yu-sun.gitbook.io/essential-git-for-scientists/cookbook/hooks.md).

# Hooks

### Rationale

* Shell scripts to be triggered when certain actions are performed (e.g. commit).
* Can be used to automate checks and routine jobs.
* Hooks are local. They won't be copied using `git clone`.

### How to run

* The hooks are stored in `.git/hooks`.
* By default, they are deactivated by the extension `.sample`.
* To use them, remove the `.sample` extension, e.g. `pre-commit.sample` -> `pre-commit`.
* The hooks are not limited to Bash, you can use Python or Perl, as long as it can be run from the terminal.

### More information

* [Git Hooks (Atlassian)](https://www.atlassian.com/git/tutorials/git-hooks)
