Skip to content

Instantly share code, notes, and snippets.

@M1ke
Created September 2, 2014 09:18
Show Gist options
  • Save M1ke/ddd742feb41e281136c1 to your computer and use it in GitHub Desktop.
Save M1ke/ddd742feb41e281136c1 to your computer and use it in GitHub Desktop.
After accidentally pushing a development branch out to production (fortunately no problems, just unexpected new features for users) I decided to proactively prevent it happening again with a simple bit of bash and git.
#!/bin/bash
# We only run the deployment if we're already on master; we could do this directly in gulp but it allows for other commands to be added
if [ $(git rev-parse --abbrev-ref HEAD) == "master" ]; then
gulp deploy
else
echo "Must be on master"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment