fix: enable diverged branch sync and target origin repo for PR creation#1678
fix: enable diverged branch sync and target origin repo for PR creation#167842tg wants to merge 1 commit intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
97e3ada to
5c61505
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
5c61505 to
5a3e8ae
Compare
ApprovabilityVerdict: Needs human review This PR enables automatic hard reset to upstream when pulling a diverged branch, which can discard local commits. This is a significant runtime behavior change with potential data loss implications that warrants careful human review. You can customize Macroscope's approvability policy. Learn more. |
5a3e8ae to
660273a
Compare
- Branch sync: when local branch diverges from remote, allow force-pull (reset to upstream) if working tree is clean - PR creation: pass --repo flag to gh pr create so PRs target the correct fork repository - Update GitActionsControl tests for new pull menu item
660273a to
3b7ec8c
Compare

Summary
--repoflag togh pr createso PRs target the correct fork repository instead of defaulting to upstream parentTest plan
Note
Medium Risk
Medium risk because
gitPullcan now hard-reset a diverged branch to its upstream, discarding local commits when the working tree is clean. Also changes PR creation targeting viagh --repo, which could affect fork/upstream selection.Overview
Improves git syncing and PR creation in forked/diverged scenarios.
On the server,
gitPullnow falls back to a newGitCore.resetToUpstream(hard reset to@{upstream}) when a fast-forward pull fails due to true divergence (ahead+behind) and the working tree is clean; it blocks this fallback when there are local uncommitted changes.For PR creation,
GitManagernow resolves theoriginrepositoryowner/repoand passes it throughGitHubCli.createPullRequest, which forwards it togh pr createvia--repoto ensure PRs are opened against the correct fork. The web UI adds aPull/Sync (force pull)action (menu + quick action), wires it to the pull mutation with toasts, and updates logic/tests to enable sync on diverged clean branches.Written by Cursor Bugbot for commit 3b7ec8c. This will update automatically on new commits. Configure here.
Note
Add pull/sync action to git controls and fix PR creation to target origin repo
GitActionsControl; labels it 'Sync (force pull)' when the branch has diverged, 'Pull' otherwisegitPullWS handler now hard-resets to upstream via a newresetToUpstreamcommand instead of failing--repo <owner/repo>togh pr createusing the origin remote's repository name, fixing PR creation in forksresetToUpstreamperforms a hard reset (git reset --hard), discarding any local commits on the branch without additional confirmationMacroscope summarized 3b7ec8c.