Skip to content

Instantly share code, notes, and snippets.

@lambda2
Last active October 17, 2016 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lambda2/1257a2b0bfd3be23c6f9f0859a1ba984 to your computer and use it in GitHub Desktop.
Save lambda2/1257a2b0bfd3be23c6f9f0859a1ba984 to your computer and use it in GitHub Desktop.
PandaCore basic pre-commit hook
if [ -d "./.git" ]; then
echo "Installing hook..."
cat > .git/hooks/pre-commit <<- EOM
#!/bin/zsh
echo "Updating Gemfile to PandaCore latest."
if [ -d "$GIT_DIR/../../panda_core" ]; then
echo "Pulling panda core..."
(cd "$GIT_DIR/../../panda_core" && git branch --set-upstream-to=origin/master master && git pull origin) || echo "Failed to pull PandaCore, you're not on the master branch, so you should pull it yourself."
fi
bundle update panda_core
EOM
chmod +x .git/hooks/pre-commit
echo "👌"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment