...

/

Hooking the Test into Git: Requirements

Hooking the Test into Git: Requirements

Learn how to hook into local Git and get to know the requirements to run the script.

Hooking into local Git

Hooking into the local Git commit process is done by putting the script we want to run in the right directory with the right name. When Git initializes a repository, it creates a subdirectory called .git in which it tracks our changes. Within that directory, a subdirectory called hooks has several files named <step>.sample for various steps in the Git process. The only two that are of interest here are:

  • Pre-commit, which runs when we commit
  • Pre-push, which runs when we push to a remote repository, usually GitHub or Bitbucket

Requirements to run the script

On a Windows ...