[Go to site: main page, start]

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hooks examples

List of hooks examples

If you have more ideas, please share them by opening an issue

Assistant

A simple assistant that displays tips based on the result of the gamble

With git 2.54.0 or higher, use this hook with this command :

git gamble hook enable assistant

With git 2.53.0 or below, download the file (post-gamble.assistant.sample.sh) and follow these steps

Real time collaboration

Specially adapted to near real-time collaboration by pushing when tests pass

With git 2.54.0 or higher, use this hook with this command :

git gamble hook enable real-time-collaboration

With git 2.53.0 or below, download the file (post-gamble.real-time-collaboration.sample.sh) and follow these steps

Time-keeper

If you are using git-time-keeper , these hooks start and stop the time-keeper between gambling

With git 2.54.0 or higher, use this hook with this command :

git gamble hook enable time-keeper

With git 2.53.0 or below, download the following files and follow these steps

Sound

A hook that plays a random sound based on the result of the gamble

The example uses sound samples from the French series Kaamelott

With git 2.54.0 or higher, use this hook with this command :

git gamble hook enable sound

With git 2.53.0 or below, download the file (post-gamble.sound.sample.sh) and follow these steps

If you want more sounds, set the environment variable KAAMELOTT_FAN=1 but beware, many are vulgar and can upset the most sensitive people

To play the sound using FFMPEG instead of VLC set the variable PLAY_COMMAND="ffplay -v 0 -nodisp -autoexit"

Any command that accepts an HTTP URL to a MP3 should work

Using with git 2.53.0 or below

  1. Download the files

  2. Get the hooks’ path :

    • the path configured by git config set core.hooksPath <PATH>
    • .git/hooks/ folder by default
    HOOKS_PATH="$(git config get core.hooksPath || echo "${GIT_DIR:-.git}/hooks")"
    
  3. Move the files to your project in the hooks’ path

  4. Concatenate the files in a single one and rename to pre-gamble or post-gamble :

    To use several examples, the files must be concatenated

    cat "$HOOKS_PATH"/pre-gamble.*.sample.sh >"$HOOKS_PATH"/pre-gamble
    
    cat "$HOOKS_PATH"/post-gamble.*.sample.sh >"$HOOKS_PATH"/post-gamble
    
  5. Make them executable :

    chmod +x "$HOOKS_PATH"/{pre,post}-gamble
    

Note : with git 2.53.0 or below, the following command will work, but the hook won’t execute

git gamble hook enable <HOOK>

Remove hook

To remove the hook, just remove the file