Skip to content

Instantly share code, notes, and snippets.

@sshadmand
Created December 25, 2014 20:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sshadmand/f33afe7c9071bb725105 to your computer and use it in GitHub Desktop.
Save sshadmand/f33afe7c9071bb725105 to your computer and use it in GitHub Desktop.
Check git diff before deploying
commit(){
echo "Please enter a commit message..."
read msg
git add . --all
git commit -am $msg
}
check_commit(){
echo ========== CHECKING FOR CHANGES ========
changes=$(git diff)
if [ -n "$changes" ]; then
echo ""
echo "*** CHANGES FOUND ***"
echo "$changes"
echo ""
echo "You have uncomitted changes."
echo "Would you like to commit them (y/n)?"
read n
case $n in
"y") commit;;
"n") echo "Changes will not be included...";;
*) echo "invalid option";;
esac
else
echo "... No changes found"
fi
}
deploy(){
check_commit
echo ========== DEPLOYING TO HEROKU ========
git push heroku master
heroku run python manage.py syncdb
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment