Skip to content

Add "Apply patch of changes to current branch" action to PR overview additional actions button #7083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 25, 2025

This PR implements a new "additional actions" button in the pull request overview that provides quick access to additional PR operations. The first action added is "Apply patch of changes to current branch" which allows users to apply a PR's changes to their current branch without checking out the PR branch.

Changes Made

Backend Implementation

  • New command handler: Added pr.apply-pr-patch command in PullRequestOverviewPanel
  • GitHub API integration: Uses GitHub's diff API with application/vnd.github.v3.diff accept header to retrieve the complete PR patch
  • Git integration: Applies the patch using VS Code's built-in git apply command
  • Error handling: Provides user-friendly success/error messages

Frontend Implementation

  • Additional Actions Button: New dropdown button with "⋯" icon in the PR overview button bar
  • Smart visibility: Only shows when PR is not currently checked out and it's not an issue
  • User experience: Includes loading states, click-outside-to-close behavior, and proper accessibility
  • Styling: Follows VS Code theme conventions with hover effects and proper positioning

UI/UX Features

  • Conditional display: Button only appears when there are available additional actions
  • Current implementation: Shows "Apply patch of changes to current branch" when PR is not checked out
  • Extensible design: Additional actions can be easily added to the dropdown in the future

Use Case

This feature is particularly useful for developers who want to:

  • Test PR changes locally without switching branches
  • Apply specific PR changes to their current working branch
  • Review and incorporate changes without full checkout

Example Usage

  1. Open a PR that is not currently checked out
  2. Click the "⋯" additional actions button in the button bar
  3. Select "Apply patch of changes to current branch"
  4. The PR's changes are applied to your current branch using git apply

Technical Notes

  • Uses GitHub's native diff format for maximum compatibility
  • Integrates with existing VS Code git operations
  • Follows established patterns from existing PR overview actions
  • Maintains backward compatibility with existing functionality

Fixes the requirement to add additional actions to PR overview with apply patch functionality.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Continuing from VS Code Add "Apply patch of changes to current branch" action to PR overview additional actions button Jun 25, 2025
@Copilot Copilot AI requested a review from alexr00 June 25, 2025 14:03
Copilot finished work on behalf of alexr00 June 25, 2025 14:03
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.

2 participants