Skip to content

feat: enhance pr dialog base branch selection#489

Merged
Shironex merged 2 commits intov0.11.0rcfrom
feature/v0.11.0rc-1768410827235-36uf
Jan 14, 2026
Merged

feat: enhance pr dialog base branch selection#489
Shironex merged 2 commits intov0.11.0rcfrom
feature/v0.11.0rc-1768410827235-36uf

Conversation

@Shironex
Copy link
Copy Markdown
Collaborator

@Shironex Shironex commented Jan 14, 2026

Preview

image image

- Updated the list-branches endpoint to accept an optional parameter for including remote branches.
- Implemented logic to fetch and deduplicate remote branches alongside local branches.
- Modified the CreatePRDialog component to utilize the updated API for branch selection, allowing users to select from both local and remote branches.
@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 enhances the user experience when creating a pull request by upgrading the base branch selection mechanism. Instead of a simple input field, users now benefit from an autocomplete component that populates with a comprehensive list of both local and remote branches, making it easier to select the correct target for their pull request.

Highlights

  • Enhanced Base Branch Selection: The 'Create PR' dialog now provides an improved base branch selection experience, allowing users to choose from both local and remote branches via an autocomplete component.
  • Backend API Update for Branch Listing: The backend list-branches endpoint has been extended to optionally fetch and return remote branches, in addition to local ones. It includes logic to deduplicate branches and fetch the latest remote refs.
  • Frontend Integration of Branch Autocomplete: The UI for the 'Create PR' dialog has been updated to use a new BranchAutocomplete component, which dynamically fetches and displays available branches (local and remote) for selection.

🧠 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.

@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.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


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.

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 enhances the 'Create Pull request' dialog by fetching and displaying remote branches for base branch selection. The backend changes in list-branches.ts correctly add an option to include remote branches, and the frontend is updated to use this via a new BranchAutocomplete component.

My review includes two main points:

  1. A high-severity fix in the backend logic in list-branches.ts to ensure that remote branches are not incorrectly filtered out when a local branch with the same name exists. This is crucial for allowing users to select common base branches like origin/main.
  2. A refactoring suggestion in create-pr-dialog.tsx to reduce code duplication and improve the maintainability of the state reset logic.

Overall, the changes are well-structured and address the feature requirement effectively. Once the suggested fix is applied, the functionality will be more robust.

Comment on lines +95 to +106
// Extract the branch name without the remote prefix for deduplication
// e.g., "origin/main" -> "main"
const branchNameWithoutRemote = cleanName.replace(/^[^/]+\//, '');

// Only add remote branches that don't exist locally (to avoid duplicates)
if (!localBranchNames.has(branchNameWithoutRemote)) {
branches.push({
name: cleanName, // Keep full name like "origin/main"
isCurrent: false,
isRemote: true,
});
}
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.

high

The current deduplication logic incorrectly prevents remote branches from being listed if a local branch with the same base name exists. For example, if a local main branch exists, the remote origin/main will be excluded. This is problematic when selecting a base branch for a pull request, as the user is then unable to select common upstream branches like origin/main or origin/develop.

To fix this, the check should compare against the full remote branch name (cleanName) to avoid adding a remote branch only if a local branch with the exact same name exists (e.g., a local branch literally named origin/main). This ensures all valid remote targets are available for selection.

              // Only add remote branches if a branch with the exact same name isn't already
              // in the list. This avoids duplicates if a local branch is named like a remote one.
              // The previous logic incorrectly stripped the remote prefix, which prevented
              // `origin/main` from being shown if a local `main` branch existed.
              if (!localBranchNames.has(cleanName)) {
                branches.push({
                  name: cleanName, // Keep full name like "origin/main"
                  isCurrent: false,
                  isRemote: true,
                });
              }

…nch exists

The branch listing logic now correctly shows remote branches (e.g., "origin/main") even if a local branch with the same base name exists, since users need remote branches as PR base targets. Also extracted duplicate state reset logic in create-pr-dialog into a reusable function.
@Shironex Shironex merged commit ca3286a into v0.11.0rc Jan 14, 2026
5 of 6 checks passed
@Shironex Shironex deleted the feature/v0.11.0rc-1768410827235-36uf branch January 14, 2026 17:39
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