spiff-arena/bin/pull_in_changes_from_outsid...

27 lines
703 B
Plaintext
Raw Normal View History

2022-10-20 11:19:18 +00:00
#!/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
2022-10-20 19:59:58 +00:00
if ! grep -q 'working tree clean' <<<"$(git status)"; then
2022-10-20 11:19:18 +00:00
>&2 echo "ERROR: you have local git changes. Please commit or stash them before running this script."
exit 1
fi
2022-10-20 19:59:58 +00:00
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
2022-10-20 11:19:18 +00:00
./bin/pull-subtrees
2022-10-20 19:59:58 +00:00
git push origin main