Update: 2025-05-30 05:31:33
This commit is contained in:
@@ -110,11 +110,18 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ────────────────
|
# ────────────────
|
||||||
# Push If Branch Is Ahead
|
# Push and Auto-Set Upstream If Needed
|
||||||
# ────────────────
|
# ────────────────
|
||||||
if git status | grep -q "Your branch is ahead"; then
|
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
|
||||||
info "Pushing to GitHub..."
|
|
||||||
git push "$GIT_REMOTE_NAME" "$(git rev-parse --abbrev-ref HEAD)" || error "Push failed"
|
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
|
else
|
||||||
info "No push needed. Everything is up to date."
|
if git status | grep -q "Your branch is ahead"; then
|
||||||
|
info "Pushing to GitHub..."
|
||||||
|
git push "$GIT_REMOTE_NAME" "$BRANCH_NAME" || error "Push failed"
|
||||||
|
else
|
||||||
|
info "No push needed. Everything is up to date."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user