Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.
/ git-hooks-vg Public archive
forked from lohrun/git-hooks

A tool to manage project and user Git hooks

License

Notifications You must be signed in to change notification settings

VoIPGRID/git-hooks-vg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: This project has been moved to gitlab! https://gitlab.wearespindle.com/voipgrid/git-hooks-vg

git-hooks-vg - A tool to manage project and user Git hooks for multiple git repositories.

git-hooks-vg lets hooks be installed inside git repositories and users home directory. When a hook is called by git, git-hooks-vg will check each of these locations for the hooks to run.

Install

Just download the git-hooks executable found in the root of this repository to a directory of your choice and ensure that it is added to your PATH environment variable so git-hooks can be run.

A quick note on git subcommands: When you type git hooks git actually looks for an executable called git-hooks. This is done automatically, so although we're directly invoking the executable (git-hooks) in the examples below, you can also use git hooks interchangably, since git will invoke git-hooks in the background when you run git hooks.

For the latest master version, and assuming you want to put the executable in /usr/local/bin/:

$ curl -o /usr/local/bin/git-hooks-vg https://raw.githubusercontent.com/VoIPGRID/git-hooks-vg/master/git-hooks-vg
$ chmod +x /usr/local/bin/git-hooks-vg

Run git-hooks-vg --install in a git project to tell it to use git-hooks-vg hooks. You can run git-hooks-vg --uninstall at any time to revert to your previous hooks. (These are usually the default hooks, which do nothing.)

Overview

Hooks are powerful and useful. Some common hooks include:

  • Spell check the commit message.
  • Verify that the code builds.
  • Verify that any new files contain a copyright with the current year in it.

Hooks can be very project-specific such as:

  • Verify that the project still builds
  • Verify that autotests matching the modified files still pass with no errors.
  • Pre-populate the commit message with a "standard" format.
  • Verify that any new code follows a "standard" coding style.

Or very person-specific hooks, such as:

  • Don't allow a push to a remote repository after 1AM, in case I break something and will be asleep.
  • Don't allow a commit between 9-5 for projects in ~/personal/, as I shouldn't be working on them during work hours.

For more details about the different hooks available to you, check out:

   http://www.kernel.org/pub/software/scm/git/docs/githooks.html

Locations

git-hooks-vg provide a way to manage and share your hooks using three locations:

  • User hooks, installed in ~/.git_hooks_vg/
  • Project hooks, installed in git_hooks_vg/ in a project.

Listing hooks

When git-hooks-vg is run without arguments, it lists all hooks installed on your system. It will run the hooks with the --about argument to generate the description shown.

Check out the hooks in contrib/ for some examples.

Creating hooks

To keep things organized, git-hooks-vg looks for scripts in sub-directories named after the git hook name.

About

A tool to manage project and user Git hooks

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%