If you add a custom remote, or a new branch, and don't fetch first,
then the script would fail when checking for unchanged branches.
Instead, skip the check: a new branch is definitely a change.
PUSH_COMMIT=$(git rev-parse "$b")
SKIP_UPSTREAM=
for u in $UPSTREAM_SKIP_SAME_AS; do
- UPSTREAM_COMMIT=$(git rev-parse "$u")
+ # Skip the branch check on error
+ UPSTREAM_COMMIT=$(git rev-parse "$u" 2>/dev/null) || continue
if [ "$PUSH_COMMIT" = "$UPSTREAM_COMMIT" ]; then
SKIP_UPSTREAM="$u"
fi