spiff-arena/bin/pull_in_changes_from_outsid...

27 lines
703 B
Bash
Executable File

#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
# HELP: git pull, pull subtrees, and push back to spiff-arena origin
if ! grep -q 'working tree clean' <<<"$(git status)"; then
>&2 echo "ERROR: you have local git changes. Please commit or stash them before running this script."
exit 1
fi
branchname=$(git symbolic-ref HEAD | cut -d'/' -f3,4)
if [[ "$branchname" != "main" ]]; then
>&2 echo "ERROR: run this thing from the main branch, not $branchname"
exit 1
fi
git pull
./bin/pull-subtrees
git push origin main