git-hooks provides a simple mechanism to manage hooks for several Git repositories in a unified and simple way. It allows you to install hook scripts in a central location and use them for your Git repositories.
cmake /path/to/git-hooks make
in a new directory (preferably, tho you may also run it from the source directory). Then, use
to install git-hooks. This will install git-hooks to
/usr/local. You can use ccmake to change the installation prefix. Below, we will assume that you installed git-hooks to
Repository setup #
To setup a repository using git-hooks, just use the repository template that ships with git-hooks.
mkdir myrepo.git cd myrepo.git git --bare init --template=/usr/local/share/git-hooks/template ...
This will setup the new repository
myrepo.git with git-hooks. Check the sample config file that will be created for
Repository migration #
To migrate an existing repository to use git-hooks, you should first backup your existing hook scripts. Then replace the hooks with the ones from
/usr/local/share/git-hooks/template/hooks. Afterwards, you should migrate your previous hook scripts to global hook scripts used by git-hooks.
The git-hooks package includes several useful hooks, which can be configured to your needs using git config settings in your repository (or even global settings from
/usr/local/share/git-hooks/template/config file provides a sample configuration file.
Please see the hook scripts in
/usr/local/share/git-hooks/*.d/ for the various supported config settings.
Available on GitHub: https://github.com/bmeurer/git-hooks
Clone the project with Git by running:
git clone git://github.com/bmeurer/git-hooks.git
If you come across any problems, please create a ticket and we will try to get it fixed as soon as possible.
Once you have made your commits:
- Fork git-hooks.
- Create a topic branch - git checkout -b my_branch
- Push to your topic branch - git push origin my_branch
- Create a Pull Request from your topic branch.
- That's it!
Copyright © 2009-2011 Benedikt Meurer. See the LICENSE file for details.