Skip to content

Instantly share code, notes, and snippets.

@xy2z
Last active March 15, 2018 09:41
Show Gist options
  • Save xy2z/545177ba7d802b9040cbeaa92517aac7 to your computer and use it in GitHub Desktop.
Save xy2z/545177ba7d802b9040cbeaa92517aac7 to your computer and use it in GitHub Desktop.
Add git hooks to a repository (so it can be shared)

Add git hooks to a repository

This only works with Git version 2.9.0 or above.

  1. Make a new directory in your repository root: mkdir .githooks and add your git hooks.
  2. Add the Makefile below to your repository root.
  3. Run the makefile: make
  4. Git add and commit the makefile and .githooks directory.
init:
git config core.hooksPath .githooks;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment