Skip to content

Instantly share code, notes, and snippets.

@carlcs
Created June 28, 2017 13:57
Show Gist options
  • Save carlcs/9a0aa9e28d3132167a6ef195b73b8df2 to your computer and use it in GitHub Desktop.
Save carlcs/9a0aa9e28d3132167a6ef195b73b8df2 to your computer and use it in GitHub Desktop.
#!/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