Skip to content

Instantly share code, notes, and snippets.

@nbeernink
Created December 18, 2017 09:28
Show Gist options
  • Select an option

  • Save nbeernink/58ffa022ad13e702281fc51fcdbaacd4 to your computer and use it in GitHub Desktop.

Select an option

Save nbeernink/58ffa022ad13e702281fc51fcdbaacd4 to your computer and use it in GitHub Desktop.
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"|| (echo "Cannot change working directory to $DIR" && exit 1)
if [ "$(readlink "$DIR"/.git/hooks/pre-commit)" = "../../pre-commit.sh" ]; then
echo "Hook already installed!";
else
ln -vs ../../pre-commit.sh .git/hooks/pre-commit && echo "Installed git-hook succesfully!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment