You want to use the configuration variable core.hooksPath but don't want to lose the ability to run local hooks ?
Then your are in the right place. GGHF will make your global hooks call your local hooks automatically.
Clone this repository where you see fit. I recommend $XDG_CONFIG_HOME/git/gghf.
git clone [email protected]:joscherrer/gghf.git ${XDG_CONFIG_HOME:-$HOME/.config}/git/gghfConfigure GGHF hooks as the default hooks with the git variable core.hooksPath.
git config --global core.hooksPath ${XDG_CONFIG_HOME:-~/.config}/git/gghf/hooksOptionnaly configure your custom global hooks with variable gghf.hooksPath.
git config --global gghf.hooksPath ${XDG_CONFIG_HOME:-~/.config}/git/hooksThen you can :
- Create global hooks in
${XDG_CONFIG_HOME:-~/.config}/git/hooks/ - Create local hooks in
.git/hooks/
GGHF uses several settings, stored in your git config, to configure its behavior.
gghf.hooksPath: Sets the path for your custom global hooks. Default:${XDG_CONFIG_HOME:-~/.config}/git/hooksgghf.mode, Sets the desired mode of operation. Default:exclusiveexclusive, (default), to execute only the first found hook in the order of precedence (see precedence)chained, to execute all the hooks one after the other in the order of precedence
gghf.reverse: Reverses the order of precedence. Default:false
For example, to configure the mode of operation to chained :
git config --global gghf.mode chainedThere are also environment variables that can be used :
GGHF_DEBUG=1: to show debug informationGGHF_TEST=1: used only to test GGHF.
To execute your hooks, GGHF establishes the following order of precedence (from first to last executed) :
- local hooks, in your
$GIT_DIRdirectory - global hooks, in your
gghf.hooksPathdirectory
This order can be reversed by changing the setting gghf.reverse.