added branch switching

This commit is contained in:
rootzoll
2018-12-07 23:51:30 +01:00
parent 7cc50e724e
commit 4b13ff93ee

View File

@@ -1,7 +1,24 @@
#!/bin/bash
# change branch if set as parameter
wantedBranch=$1
activeBranch=$(git branch | grep \* | cut -d ' ' -f2)
if [ ${#wantedBranch} -gt 0 ]; then
echo "your wanted branch is: ${wantedBranch}"
echo "your active branch is: ${activeBranch}"
if [ "${wantedBranch}" = "${activeBranch}" ]; then
echo "OK"
else
echo "try changing branch .."
git checkout ${wantedBranch}
activeBranch=$(git branch | grep \* | cut -d ' ' -f2)
fi
fi
echo ""
echo "*** UPDATING SHELL SCRIPTS FROM GITHUB ***"
echo "justincase, not the final upadte mechanism"
echo "BRANCH --> ${activeBranch}"
echo "******************************************"
cd /home/admin/raspiblitz
git pull