aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind2016-11-24 21:21:06 +0100
committerMaZderMind2016-11-24 21:21:06 +0100
commit816d6b118b0c2e77268dd5c12be59301d72d9548 (patch)
tree799e0f59f156e882ae858660ebe8490330a6fb88
parenta65ed1709a34e03daa9a167f2c40f0525da48e7e (diff)
check for uncomtted or unpushed changes before deployment
-rwxr-xr-xdeploy.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/deploy.sh b/deploy.sh
index be856ee..746215d 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,5 +1,15 @@
#!/bin/sh
+if [ `git rev-parse --verify origin/master` != `git rev-parse --verify master` ]; then
+ echo "You have commits on the master branch not pushed to origin yet. They would not be deployed. aborting"
+ exit 2
+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. aborting"
+ exit 2
+fi
+
command -v find >/dev/null 2>&1 || { echo >&2 "I require find but it's not installed. Aborting."; exit 1; }
command -v xargs >/dev/null 2>&1 || { echo >&2 "I require xargs but it's not installed. Aborting."; exit 1; }
command -v php >/dev/null 2>&1 || { echo >&2 "I require php but it's not installed. Aborting."; exit 1; }