Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.