Tracking changes to hooks in .git/hooks

http://benjamin-meyer.blogspot.com/2008/10/git-hooks.html Files in the .git/hooks directory are not part of the repository and so they are not tracked. A workaround is to have a git_hooks directory at the top of your repository like done in Arora and symlink .git/hooks to git_hooks whenever you clone. This way the hooks will be part of the project, under … Read more

How do I react to new tags in git hooks?

Tags are refs like any other (like commit). If tags are pushed to a repo with a post-receive hook, that hook will be called and will list all updated refs, that is both old and new values of all the refs in addition to their names (on its standard input). See this server post-receive email … Read more

Git remote/shared pre-commit hook

I don’t think so, as hooks are not cloned. May be if that hook script is itself versioned, and then link to (symbolic link) in the clone servers (provided their OS support that link feature). Or maybe if the hooks are part of a git template directory used for creating the clones (that would only … Read more

change default git hooks

From the git-init man page (also works with git-clone if you are cloning an existing repo instead of creating a new one from scratch): –template=<template_directory> Provide the directory from which templates will be used. The default template directory is /usr/share/git-core/templates. When specified, <template_directory> is used as the source of the template files rather than the … Read more

Local executing hook after a git push?

Another solution to this problem is to have a wrapper for git push that executes .git/hooks/pre-push and .git/hooks/post-push scripts before and after the git push call. A possible wrapper could look like this: #!/bin/sh GIT_DIR_=”$(git rev-parse –git-dir)” BRANCH=”$(git rev-parse –symbolic –abbrev-ref $(git symbolic-ref HEAD))” PRE_PUSH=”$GIT_DIR_/hooks/pre-push” POST_PUSH=”$GIT_DIR_/hooks/post-push” test -x “$PRE_PUSH” && exec “$PRE_PUSH” “$BRANCH” “$@” git … Read more