fix(drift): pre-delete stale remote branch before push#106
Merged
Conversation
The re-dispatch after #105 merged failed in cursor's leg: ! [remote rejected] chore/upstream-drift-cursor-20260524 (non-fast-forward) hint: 'git pull' before pushing again. The branch on origin was left behind when #104 was closed (no auto-delete fires on close, only on merge). The dedupe guard at the top of the script only checks for OPEN PRs with the matching title, so it didn't catch this case. Add an unconditional `git push --delete origin "$BRANCH"` before the push. The dedupe guard guarantees we only get here when no open PR exists, so any leftover remote ref is from a closed attempt and safe to drop. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-dispatch after #105 surfaced a third bug: cursor's leg failed with
non-fast-forwardbecause the branchchore/upstream-drift-cursor-20260524was left behind on origin when #104 was closed (GitHub only auto-deletes branches on merge, not close). The dedupe guard at the top of the script only checks for open PRs, so it didn't catch this.Add an unconditional
git push --delete origin "$BRANCH"before the push. The dedupe guard guarantees we only get here when no open PR exists, so any leftover remote ref is from a closed/abandoned attempt and safe to drop.Test plan
bash -n+shellcheckcleanchore/upstream-drift-cursor-20260524branch one-time, re-dispatch, confirm all three vendors complete and cursor opens a clean PR.🤖 Generated with Claude Code