Created
December 27, 2019 18:12
-
-
Save dariocravero/af9200e153aa242e44f93b4157a69503 to your computer and use it in GitHub Desktop.
This file contains 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
CHANGES=`git log origin/production..origin/master`; | |
if [ -z "$CHANGES" ]; then | |
echo "✅ Production is already in sync with master"; | |
exit; | |
fi; | |
echo "" | |
echo "" | |
echo "📝 This is what's on master that's could be released to production:" | |
echo "" | |
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative origin/production..origin/master | |
echo "" | |
echo "" | |
while true; do | |
read -p "🧐 Do you want to release what's on master to production? [yes/no] " yn | |
case $yn in | |
[Yy]es ) | |
git checkout production; | |
git reset --hard origin/master; | |
git push; | |
git checkout -; | |
echo ""; | |
echo "☀️ Production is in sync with master now. Keep at it 🚀!"; | |
break;; | |
[Nn]o ) | |
echo "🤐 I did nothing."; | |
exit;; | |
* ) echo "🤬 Please answer yes or no.";; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:)