---
title: Manually Run Git Hooks
description: Sometimes you want to manually run a Git hook, like a pre-commit hook, for testing. This can be done from the shell.
date: 2022-04-01
tags: Git, Git Hooks
source: https://brianchildress.co/blog/manually-run-git-hooks
---

# Manually Run Git Hooks

Sometimes you want to manually run a Git hook, like a pre-commit hook, for testing. This can be done from the shell.

 1. Navigate to the directory containing your Git repository
    ```sh
    cd /path/to/code
    ```

    _Example directory:_

    |- .git  
    |--- hooks  
    |----- pre-commit  
    |- src  
    |--- file.js  
    |- READEME.md  

 2. Run hook using your shell
    ```sh
    bash <path to hook>

    # Ex:
    bash .git/hooks/pre-commit
    ```
