Testing GIT Hooks Before Actually Committing


If you’re using GIT hooks and want to be able to test them without adding cruft to your GIT repository, you can easily test individual hooks anytime. GIT hooks are, by default, executable files that can be run through a simple bash command.

From your repository

$ bash .git/hooks/pre-commit

This will execute the GIT hook and provide quick feedback without adding additional “testing” commits to your repo.

If you’re interested in getting GIT hooks setup for your JavaScript project, here’s a post on getting started: Save Yourself from Yourself.