Skip to content

Instantly share code, notes, and snippets.

@bdlangton
Created September 22, 2016 21:45
Show Gist options
  • Select an option

  • Save bdlangton/a03686bbe0387f5b2539350bd3a3c453 to your computer and use it in GitHub Desktop.

Select an option

Save bdlangton/a03686bbe0387f5b2539350bd3a3c453 to your computer and use it in GitHub Desktop.

Revisions

  1. Barrett Langton created this gist Sep 22, 2016.
    12 changes: 12 additions & 0 deletions update-hooks
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/usr/bin/env bash

    # Check that the git directory exists.
    GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
    if [ -z "$GIT_DIR" ]; then
    echo >&2 "Fatal: GIT_DIR not set"
    exit 1
    fi

    # Remove existing hooks and re-init to copy new hooks.
    rm $GIT_DIR/hooks/*
    git init