From: Jonathan Nieder Date: Fri, 02 Jul 2010 20:53:49 GMT Subject: Re: global hooks - once again Message-ID: <20100702205348.GA8134@burratino> In-Reply-To: <7v630x1yl8.fsf@alter.siamese.dyndns.org> Junio C Hamano wrote: > Now, as long as the "do once per repository" action that you need to do is > simple enough, it doesn't necessarily have to be "git config". Perhaps > > [alias] > set-hooks = !"sh -c 'rm -fr .git/hooks && ln -s $1 .git/hooks' -" It is not difficult to set up hook scripts when initializing a repository. In fact git clone --template= and the “[init] templatedir” configuration work pretty well. What is more difficult is to change the list of hook scripts later. If I symlink the entire hooks dir like you describe, I cannot override a couple of hooks per-repository without teaching the hook scripts to handle that themselves. (something like: hook=$(basename "$0") ! test -e "$GIT_DIR/local-hooks/$hook.disable" || exit 0 ! test -e "$GIT_DIR/local-hooks/$hook" || exec "$GIT_DIR/local-hooks/$hook" ) Maybe that is the simplest solution.