Created
December 25, 2014 20:44
-
-
Save sshadmand/f33afe7c9071bb725105 to your computer and use it in GitHub Desktop.
Check git diff before deploying
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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