#!/usr/bin/env bash # Switch to my main branch and pull any changes from the remote. set -o errexit set -o nounset ROOT="$(git rev-parse --show-toplevel)" REPO_NAME="$(basename "$ROOT")" if git remote get-url origin | grep "phaenna-mac-mini" >/dev/null; then ensure_on_tailnet.sh "alexwlchan.github" fi # Checking for the branch first is a bit slower, but avoids a potentially # confusing warning immediately before the pull: # # Already on 'main' # Your branch is up to date with 'origin/main'. # # The `--quiet` flag is to avoid a warning like: # # Your branch is behind 'origin/main' by 6 commits, and can be # fast-forwarded. # # because I know I'm about to do that. if [[ $(gcb) != $(_get_primary_branch) ]] then print_info "-> git checkout $(_get_primary_branch) (was on $(gcb))" git checkout "$(_get_primary_branch)" --quiet echo "" fi # This avoids any clashes with other programs called "gp", e.g. at one # point I had gitpython in my PATH $(dirname "$0")/gp echo "" cleanup_branches