Add checkout pull request in worktree option#8513
Draft
Conversation
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
… naming Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add checkout pull request in worktree option for context menu
Add checkout pull request in worktree option
Feb 13, 2026
…l execution Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Contributor
Author
alexr00
requested changes
Feb 13, 2026
src/commands.ts
Outdated
Comment on lines
918
to
922
| const openAction = vscode.l10n.t('Open in New Window'); | ||
| const result = await vscode.window.showInformationMessage( | ||
| vscode.l10n.t('Worktree created for Pull Request #{0}', pullRequestModel.number), | ||
| openAction | ||
| ); |
Member
There was a problem hiding this comment.
@copilot This should happen after the progress is finished, otherwise the progress reports until this info is acked.
Contributor
Author
There was a problem hiding this comment.
Moved the info message to after the progress completes in commit ad74445. The showInformationMessage call now happens after withProgress resolves.
src/commands.ts
Outdated
Comment on lines
874
to
891
| try { | ||
| await repositoryToUse.fetch({ remote: remoteName, ref: branchName }); | ||
| } catch (e) { | ||
| const errorMessage = e instanceof Error ? e.message : String(e); | ||
| Logger.appendLine(`Failed to fetch branch ${branchName}: ${errorMessage}`, logId); | ||
| // Continue even if fetch fails - the branch might already be available locally | ||
| } | ||
|
|
||
| // Ask user for worktree location | ||
| const repoRootPath = repositoryToUse.rootUri.fsPath; | ||
| const parentDir = pathLib.dirname(repoRootPath); | ||
| const defaultWorktreePath = pathLib.join(parentDir, `pr-${pullRequestModel.number}`); | ||
|
|
||
| const worktreeUri = await vscode.window.showSaveDialog({ | ||
| defaultUri: vscode.Uri.file(defaultWorktreePath), | ||
| title: vscode.l10n.t('Select Worktree Location'), | ||
| saveLabel: vscode.l10n.t('Create Worktree'), | ||
| }); |
…after progress Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
alexr00
reviewed
Feb 13, 2026
src/commands.ts
Outdated
| const remoteName = pullRequestModel.remote.remoteName; | ||
|
|
||
| // Run fetch and worktree location selection in parallel | ||
| const [, worktreeUri] = await Promise.all([ |
Contributor
Author
There was a problem hiding this comment.
Restructured the code in commit 766d8a0. The progress now starts before the fetch operation and covers both fetch and worktree creation. The dialog for selecting the worktree location is shown before the progress starts.
… scope Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pr.pickInWorktreein package.json (command definition)pr.pickInWorktreecommand in src/commands.tsSummary
This PR adds a new context menu option "Checkout Pull Request in Worktree" that allows users to check out a PR branch in a git worktree instead of the main working directory. This enables reviewing colleagues' PRs without having to commit current work, stash changes, or deal with merge conflicts.
Implementation Details
createWorktreeAPI!isWebwhen clauseOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.