Created
June 28, 2017 13:57
-
-
Save carlcs/9a0aa9e28d3132167a6ef195b73b8df2 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
#!/bin/bash | |
BASE_PATH="./" | |
R0=(craft-assetmetadata v2 v3) | |
R1=(craft-elementstats v1 v2) | |
R2=(craft-footnotes v1 v2) | |
R3=(craft-maintenance v2 v3) | |
for i in {0..10} | |
do | |
var="R$i[@]" | |
REPO=("${!var}") | |
REPO_PATH=${BASE_PATH}${REPO[0]} | |
case $1 in | |
c2|craft2) NEW_BRANCH=${REPO[1]} ;; | |
c3|craft3) NEW_BRANCH=${REPO[2]} ;; | |
esac | |
if [ -n "${NEW_BRANCH}" ] && [ -d "${REPO_PATH}" ] && [ -d "${REPO_PATH}/.git" ] | |
then | |
echo "Switching branch to ${NEW_BRANCH} in ${REPO_PATH}" | |
git -C ${REPO_PATH} checkout ${NEW_BRANCH} | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment