Skip to content

feat: merge worktree to main in dropdown menu#492

Merged
Shironex merged 1 commit intov0.11.0rcfrom
feature/v0.11.0rc-1768413895104-31pa
Jan 14, 2026
Merged

feat: merge worktree to main in dropdown menu#492
Shironex merged 1 commit intov0.11.0rcfrom
feature/v0.11.0rc-1768413895104-31pa

Conversation

@Shironex
Copy link
Copy Markdown
Collaborator

@Shironex Shironex commented Jan 14, 2026

Summary

  • Fixed merge handler to accept branchName and worktreePath directly instead of deriving them from featureId
  • Added 2-step confirmation dialog (type "merge" to confirm) for safer merge operations
  • Removed feature branch naming restriction - any branch can now be merged
  • Added branch existence validation before attempting merge

Test plan

  • Create a feature using auto-mode (generates branch like feature/main-1234567890-xyz)
  • Make some changes and commit them
  • Click "Merge to Main" from the worktree dropdown
  • Verify the 2-step confirmation dialog appears
  • Type "merge" to confirm
  • Verify the merge completes successfully
  • Verify the worktree is removed
  • Verify the branch is deleted
  • Test with custom branch names as well

Closes #408

The merge handler previously hardcoded branch names as `feature/${featureId}`
and worktree paths as `.worktrees/${featureId}`, which failed for auto-generated
branches (e.g., `feature/v0.11.0rc-1768413895104-31pa`) and custom worktrees.

Changes:
- Server handler now accepts branchName and worktreePath directly from the UI
- Added branch existence validation before attempting merge
- Updated merge dialog with 2-step confirmation (type "merge" to confirm)
- Removed feature branch naming restriction - any branch can now be merged
- Updated API types and client to pass correct parameters

Closes #408

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 14, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the worktree merge functionality by making it more adaptable and secure. It addresses previous constraints related to branch and worktree path derivation, allowing for a wider range of use cases. The introduction of a multi-step confirmation dialog and pre-merge branch validation enhances the user experience by preventing unintended actions and increasing confidence in the merge process.

Highlights

  • Flexible Merge Handler: The worktree merge handler now directly accepts branchName and worktreePath, removing previous limitations tied to featureId and allowing for merging of auto-generated or custom-named branches.
  • Enhanced User Safety: A new 2-step confirmation dialog has been introduced for merge operations, requiring explicit user input to prevent accidental merges. Additionally, branch existence is validated before any merge attempt.
  • Removed Branch Naming Restrictions: The system no longer imposes naming restrictions on feature branches, enabling any branch to be merged into the main branch.
  • New Merge Worktree Dialog UI: A dedicated UI component (MergeWorktreeDialog) has been added to guide users through the merge process, providing clear information about the actions to be performed and any potential warnings (e.g., uncommitted changes).

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Shironex Shironex changed the title fix: merge worktree handler now uses correct branch name and path feat: merge worktree to main in dropdown menu Jan 14, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the merge worktree handler to accept branchName and worktreePath directly, improving flexibility and addressing previous limitations with auto-generated and custom branch names. It also introduces a 2-step confirmation dialog for merge operations and adds branch existence validation. The changes correctly update the API signatures and UI components to reflect the new parameters. However, there are critical security vulnerabilities related to command injection in the server-side merge logic, and a minor maintainability issue with duplicated interface definitions in the UI.

Comment on lines +17 to +22
interface WorktreeInfo {
path: string;
branch: string;
isMain: boolean;
hasChanges?: boolean;
changedFilesCount?: number;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The WorktreeInfo interface is duplicated here. It is already defined in apps/ui/src/components/views/board-view/worktree-panel/types.ts. To improve maintainability and avoid redundancy, please import and reuse the existing interface definition.

import type { WorktreeInfo } from '../../board-view/worktree-panel/types';

@Shironex Shironex added Enhancement Improvements to existing functionality or UI. Testers-Requested Request for others to test an enhancement or bug fix/etc. Do Not Merge Use this label if something should not be merged. labels Jan 14, 2026
@Shironex Shironex merged commit 7ea1383 into v0.11.0rc Jan 14, 2026
7 of 8 checks passed
@Shironex Shironex deleted the feature/v0.11.0rc-1768413895104-31pa branch January 14, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do Not Merge Use this label if something should not be merged. Enhancement Improvements to existing functionality or UI. Testers-Requested Request for others to test an enhancement or bug fix/etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant