Update: 2025-05-30 05:31:33

This commit is contained in:
Mark Randall Havens 2025-05-30 05:31:33 -05:00
parent e3398c550d
commit 8895255af2

View file

@ -110,11 +110,18 @@ else
fi
# ────────────────
# Push If Branch Is Ahead
# Push and Auto-Set Upstream If Needed
# ────────────────
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
if git status 2>&1 | grep -q "no upstream"; then
info "Setting upstream for '$BRANCH_NAME' to '$GIT_REMOTE_NAME'..."
git push -u "$GIT_REMOTE_NAME" "$BRANCH_NAME" || error "Failed to push and set upstream"
else
if git status | grep -q "Your branch is ahead"; then
info "Pushing to GitHub..."
git push "$GIT_REMOTE_NAME" "$(git rev-parse --abbrev-ref HEAD)" || error "Push failed"
git push "$GIT_REMOTE_NAME" "$BRANCH_NAME" || error "Push failed"
else
info "No push needed. Everything is up to date."
fi
fi