Clicking "checkout" on a PR from a branch already in a worktree fails

未关闭
#9,161 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
git, github, typescript, vscode

调研方向

Start by tracing the pull request checkout command in the VS Code extension and how it handles branches already checked out in a worktree. The issue suggests offering a separate local review branch with the PR’s remote as upstream; inspect existing checkout options and tests to see how that flow fits. Done means reviewing a PR whose branch is already in another worktree can proceed through the proposed option.

由索引模型根据 Issue 内容生成。

描述

  • Extension version: 0.174.0
  • VSCode Version: 1.144.0
  • OS: macOS Sequoia 15.8.1
  • Repository Clone Configuration (single repository/fork of an upstream repository): single repository
  • GitHub Product (GitHub.com/GitHub Enterprise version x.x.x): Github.com

Steps to Reproduce:

  1. Agentic workflows often checkout a branch locally in a worktree and push.
  2. Create a PR with the new branch
  3. From your main project clone, try to "checkout" the PR to review

The dialog shows:

Error switching to pull request: Failed to execute git

In the output, we see:

2026-11-04 09:03:03.760 [info] fatal: '<branch>' is already used by worktree at '<path>'

Problem 1: this shows as an [info] message, so it's easy to miss
Problem 2: with agentic workflows where reviewing multiple PRs is more common, there's friction in trying to find the appropriate local worktree and open VSCode in a new window.

A simple fix would be to provide an option to always open a new local branch just for the PR review with the remote as the upstream, e.g. gh/pr-local/NNN -> feat-1234. Then there's much less likelihood of a collision with agent worktrees.

主要语言
TypeScript
星标
2.6k
派生
811
平均合并
1 天 5 小时
30 天内合并 PR
71

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/vscode-pull-request-github 的其他 Issue

查看 microsoft/vscode-pull-request-github 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。