Skip to content

fix(desktop): don't checkout main after merging PR from changes sidebar#1259

Merged
Kitenite merged 2 commits into
mainfrom
kitenite/buttercup
Feb 6, 2026
Merged

fix(desktop): don't checkout main after merging PR from changes sidebar#1259
Kitenite merged 2 commits into
mainfrom
kitenite/buttercup

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Feb 6, 2026

Summary

  • Removed --delete-branch flag from gh pr merge in the mergePR mutation — this was causing gh to checkout main locally after merging, unexpectedly switching the worktree away from the feature branch
  • Removed the deleteBranch parameter from both the tRPC input schema and the PRButton call site since it's no longer used

Test plan

  • Checkout a feature branch with an open PR
  • Merge via the changes sidebar
  • Confirm the local checkout stays on the feature branch (not main)

Summary by CodeRabbit

  • Changes
    • Removed automatic branch deletion when merging pull requests. Branches will no longer be automatically cleaned up after merge operations, providing more control over branch lifecycle management in the desktop application.

…sidebar

gh pr merge --delete-branch checks out the default branch locally after
merging, causing the worktree to unexpectedly switch to main. Remove the
--delete-branch flag and the deleteBranch parameter entirely so the local
checkout stays on the current branch.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Two files are updated to remove the deleteBranch parameter from the mergePR mutation. The schema in git-operations.ts no longer declares this option, and its corresponding logic appending --delete-branch is eliminated. The PRButton component call is updated to stop passing deleteBranch: true.

Changes

Cohort / File(s) Summary
Git PR Merge Schema and Logic
apps/desktop/src/lib/trpc/routers/changes/git-operations.ts
Removed deleteBranch parameter from mergePR input schema and eliminated conditional logic that appended --delete-branch flag to the gh command.
PR Merge Handler
apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ChangesHeader/components/PRButton/PRButton.tsx
Updated mergePR mutation call to no longer pass deleteBranch: true argument.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 The branch deletion logic hops away,
No more automatic cleanup to play,
We keep it simpler, light as a hop,
The feature removal, neat as a drop! 🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing the --delete-branch behavior that was causing unexpected checkout of main after merging a PR.
Description check ✅ Passed The description provides a clear summary of changes, includes a test plan with specific verification steps, and adequately explains the problem and solution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/buttercup

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kitenite Kitenite merged commit cffcda3 into main Feb 6, 2026
5 checks passed
@Kitenite Kitenite deleted the kitenite/buttercup branch February 6, 2026 23:22
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 6, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant