diff options
-rwxr-xr-x | deploy.sh | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -13,9 +13,10 @@ fi echo "" DEPLOY_BRANCH=`git rev-parse --abbrev-ref HEAD` -if [ "x$DEPLOY_BRANCH" != "xmaster" ]; then - echo "You're currently on branch $DEPLOY_BRANCH." - echo "Are you sure you want to deoloy that branch (and not master)? then type yes" + +if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $DEPLOY_BRANCH` ]; then + echo "You have commits on the $DEPLOY_BRANCH branch not pushed to origin yet. They would not be deployed." + echo "do you still which to deploy what's already in the repo? then type yes" read -p "" input if [ "x$input" != "xyes" ]; then exit 2 @@ -23,8 +24,8 @@ if [ "x$DEPLOY_BRANCH" != "xmaster" ]; then echo "" fi -if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $DEPLOY_BRANCH` ]; then - echo "You have commits on the $DEPLOY_BRANCH branch not pushed to origin yet. They would not be deployed." +if ! (git diff --exit-code >/dev/null && git diff --cached --exit-code >/dev/null); then + echo "You have uncomitted changes. They would not be deployed." echo "do you still which to deploy what's already in the repo? then type yes" read -p "" input if [ "x$input" != "xyes" ]; then @@ -33,9 +34,9 @@ if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $ echo "" fi -if ! (git diff --exit-code >/dev/null && git diff --cached --exit-code >/dev/null); then - echo "You have uncomitted changes. They would not be deployed." - echo "do you still which to deploy what's already in the repo? then type yes" +if [ "x$DEPLOY_BRANCH" != "xmaster" ]; then + echo "You're currently on branch $DEPLOY_BRANCH." + echo "Are you sure you want to deoloy that branch (and not master)? then type yes" read -p "" input if [ "x$input" != "xyes" ]; then exit 2 |