Skip to content

A configurable library of useful client side (local) git hooks

License

Notifications You must be signed in to change notification settings

rudikershaw/client-git-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT Licence Build Status GitHub version Github all downloads

Client Git Hooks

A set of useful and generic client side (local) git hooks. To add all of them to your project simply copy the git-hooks directory into the root of your project and then notify Git that this directory is to be used for its hooks. You can do this using the following command;

git config core.hooksPath git-hooks/

The above will only work if you are using Git 2.9 or greater. Otherwise you will need to either, copy the contents of the git-hooks directory in this project into the .git/hooks directory, or replace the .git/hooks directory with a symlink to the new directory.

Hook Functions Performed

  • exclude-strings - prevent commits including changes with specified strings.
  • file-size - prevent commits including files above a specified size.
  • message-format - prevent commit messages that do not match a specified pattern.
  • verify-author - prevents commits from users without author details set correctly.

Custom Configuration

The behaviour of these hooks can be changed by specifying custom git configuration. Each function performed by this library of standardized hooks has custom git configuration that can be added. To view more details of the configuration available for each hook, click the name of the hook in the previous list to be taken to the documentation.