代理已完成您大部分更改。现在,您希望检查一个实现细节,手动调整几行代码,并在发布之前在本地运行项目。
但工作正停留在 GitHub Copilot 应用程序中……而您的编辑器才是您审查差异、调试代码和进行最终调整的地方。您是否必须在留在会话中和在 Visual Studio Code 中重新开始之间做出选择?
不必如此。您可以直接在 VS Code 中打开 Copilot 应用程序会话,并保持其对话、代码更改和工作上下文完整无缺。这意味着 Copilot 可以处理重复性或耗时的工作,然后将控制权交还给您,以便进行更仔细的审查、动手编辑和本地测试。
在本教程中,您将学习如何:
在 VS Code 中打开 Copilot 应用程序会话。
逐行审查代理的更改。
从编辑器继续同一对话。
在本地修改和测试代码。
将更新推送到与会话关联的拉取请求(Pull Request)。
前置条件
在开始之前,请确保您具备:
已安装并登录 GitHub Copilot 应用程序。
已安装 Visual Studio Code 并连接到同一个 GitHub 账户。
一个包含您想要审查或继续的代码更改的 Copilot 应用程序会话。
对会话所在仓库进行工作并推送更改的权限。
本教程假设您已经熟悉在 VS Code 中导航、在其集成终端中运行命令,以及使用 Git 分支和拉取请求。
打开您想要继续的会话。在移交之前,花一点时间审查任务以及 Copilot 完成的工作。
一个会话不仅仅是一组修改文件的集合。它还记录了生成这些更改的任务、计划和对话。当您想了解 Copilot 为何选择某种特定实现,或要求它修改部分工作时,这种上下文非常重要。
您无需在转移到 VS Code 之前总结这段历史或将其复制到新的聊天中。
从会话中选择“在 VS Code 中打开”(Open in VS Code)。如果应用程序提供多个支持的编辑器或 VS Code 安装版本,请选择您想要使用的那个。
VS Code 会使用与会话关联的工作树(worktree)打开项目。它还会在 Copilot 侧边栏中显示现有会话。
这为您提供了原始工作的三个连接部分:
会话上下文:任务、计划和对话仍然可用。
差异(Diff):代理更改的文件和行已准备好供审查。
工作树:VS Code 打开了与会话使用的相同隔离工作树。
您是在继续现有的会话,而不是在新的编辑器窗口中重建它。
在编辑之前,请在 VS Code 中检查差异。打开源代码控制(Source Control)视图以查看已更改的文件,然后选择一个文件以逐行审查其更改。
像审查任何其他建议的更改一样审查实现。特别是,请检查:
代码是否解决了请求的问题。
实现是否符合仓库的约定。
错误状态和边缘情况是否得到适当处理。
测试是否覆盖了发生变化的行为。
没有修改不相关的文件或行为。
保留的对话可以帮助解释 Copilot 是如何得出该实现的。如果有什么不清楚的地方,请在侧边栏中继续向 Copilot 提问。例如:
解释为什么您更改了这个函数而不是添加一个新的辅助函数。指出这可能影响到的任何行为。
您还可以要求 Copilot 进行另一次更改。由于会话和工作树保持连接,您无需从头开始描述任务。
一旦了解了建议的更改,即可直接在 VS Code 中编辑任何文件。
这对于通过手动方式更快或更容易进行的调整非常有用,例如:
优化标签或错误消息。
重命名变量以提高清晰度。
调整布局或样式。
添加缺失的测试用例。
应用特定于仓库的约定。
您正在编辑该会话的工作树的现有内容,因此您的手动更改将直接建立在智能体工作的基础之上。您无需在目录之间复制文件,也无需手动重新创建分支。
使用 VS Code 集成终端来运行项目的常规验证工作流。具体命令取决于仓库,但某些 Web 应用示例可能包括:
npm install
npm test
npm run lint
npm run dev
对待智能体生成的更改,应如同对待人工编写的代码一样:运行相关测试,检查失败原因,并亲自验证其行为。
如果开发服务器打印出 localhost URL,请打开它以在浏览器中测试更改。如果您的 VS Code 设置支持此功能,您可以在 VS Code 的集成浏览器中打开该 URL,并在不离开编辑器的情况下检查结果。
对于用户界面更改,请验证请求的行为以及邻近状态。例如,在不同视口大小下检查修改后的组件,并确认加载、空和错误状态仍然正常工作。
在任何时候,您都可以选择最适合下一步的交互方式:
当更改需要跨仓库分析或重复性编辑时,向 Copilot 发出提示。
当您确切知道想要进行的更改时,直接进行编辑。
在测试和优化实现的过程中,迭代使用这两种方法。
例如,在进行手动 UI 调整后,您可以询问 Copilot:
为更新后的标签添加测试并运行相关测试文件。请勿修改不相关的组件。
由于您仍处于原始会话中,Copilot 保留了理解“更新后的标签”所需的上下文。
当实现准备就绪时,再次审查最终的差异(diff)。然后使用源代码控制视图或集成终端提交并推送更改:
git status
git add
git commit -m "Refine session changes"
git push
遵循您仓库的常规分支、提交、审查和批准实践。由于 VS Code 打开了与会话关联的工作树和分支,推送该分支将更新已跟踪该工作的拉取请求(Pull Request)。
无需将完成的文件复制到另一个签出目录,也无需手动重新连接工作以将其与拉取请求关联。
从智能体到编辑器的连续工作流
在 VS Code 中打开 Copilot 应用会话,可实现劳动力的清晰分工,而无需拆分工作本身。Copilot 可以承担更大或重复性的实现任务,而您可以进入编辑器进行详细审查、针对性更改、本地测试和最终润色。
会话、差异和工作树与您一同移动。首先在 Copilot 应用中指导工作,随时切换到 VS Code 以获取手动控制权,并通过相同的拉取请求工作流推送最终结果。
准备好尝试了吗?下载 GitHub Copilot 应用,启动一个会话,并在准备继续编码时在 VS Code 中打开它。
作者
高级 AI 开发者工具倡导者
The agent has finished the bulk of your change. Now you want to inspect one implementation detail, adjust a few lines by hand, and run the project locally before you ship it.
But the work is sitting in the GitHub Copilot app … and your editor is where you review diffs, debug code, and make final adjustments. Do you have to choose between staying in the session and starting over in Visual Studio Code?
You don’t. You can open the Copilot app session directly in VS Code and continue with its conversation, code changes, and working context intact. That means Copilot can handle the repetitive or time-consuming work, then hand control back to you for closer review, hands-on editing, and local testing.
In this tutorial, you’ll learn how to:
Open a Copilot app session in VS Code.
Review the agent’s changes line by line.
Continue the same conversation from your editor.
Modify and test the code locally.
Push your updates to the pull request associated with the session.
Prerequisites
Before you begin, make sure you have:
The GitHub Copilot app installed and signed in.
Visual Studio Code installed and connected to the same GitHub account.
A Copilot app session with code changes you want to review or continue.
Permission to work in and push changes to the session’s repository.
This tutorial assumes you are already comfortable navigating VS Code, running commands in its integrated terminal, and working with Git branches and pull requests.
Open the session you want to continue. Before handing it off, take a moment to review the task and the work Copilot completed.
A session contains more than a collection of modified files. It also records the task, the plan, and the conversation that produced those changes. That context is important when you want to understand why Copilot chose a particular implementation or ask it to revise part of the work.
You do not need to summarize that history or copy it into a new chat before moving to VS Code.
From the session, select Open in VS Code . If the app presents more than one supported editor or VS Code installation, choose the one you want to use.
VS Code opens the project using the worktree associated with the session. It also displays the existing session in the Copilot sidebar.
That gives you three connected pieces of the original work:
The session context: The task, plan, and conversation remain available.
The diff: The files and lines changed by the agent are ready for review.
The worktree: VS Code opens the same isolated working tree the session used.
You are continuing the existing session, not reconstructing it in a new editor window.
Before editing, inspect the diff in VS Code. Open the Source Control view to see the changed files, then select a file to review its changes line by line.
Review the implementation as you would any other proposed change. In particular, check that:
The code solves the requested problem.
The implementation follows the repository’s conventions.
Error states and edge cases are handled appropriately.
Tests cover the behavior that changed.
No unrelated files or behaviors were modified.
The preserved conversation can help explain how Copilot arrived at the implementation. If something is unclear, continue prompting Copilot in the sidebar. For example:
Explain why you changed this function instead of adding a new helper. Identify any behavior this could affect.
You can also ask Copilot to make another change. Because the session and worktree remain connected, you do not have to describe the task from the beginning.
Once you understand the proposed changes, edit any file directly in VS Code.
This is useful for adjustments that are faster or easier to make by hand, such as:
Refining a label or error message.
Renaming a variable for clarity.
Adjusting layout or styling.
Adding a missing test case.
Applying a repository-specific convention.
You are editing the session’s existing worktree, so your manual changes build directly on the agent’s work. You do not need to copy files between directories or manually re-create the branch.
Use the VS Code integrated terminal to run the project’s normal validation workflow. The exact commands depend on the repository, but some web app examples may include:
npm install
npm test
npm run lint
npm run dev
Treat agent-generated changes the same way you would treat code written by a person: run the relevant tests, inspect failures, and verify the behavior yourself.
If the development server prints a localhost URL, open it to test the change in a browser. When supported by your VS Code setup, you can open the URL in VS Code’s integrated browser and inspect the result without leaving the editor.
For a user-interface change, verify both the requested behavior and nearby states. For example, check the modified component at different viewport sizes and confirm that loading, empty, and error states still work.
At any point, you can choose the interaction that best fits the next step:
Prompt Copilot when the change requires repository-wide analysis or repetitive edits.
Edit directly when you know the exact change you want.
Use both approaches iteratively as you test and refine the implementation.
For example, after making a manual UI adjustment, you might ask Copilot:
Add a test for the updated label and run the relevant test file. Do not modify unrelated components.
Because you are still in the original session, Copilot retains the context needed to interpret “the updated label.”
When the implementation is ready, review the final diff one more time. Then commit and push the changes using the Source Control view or the integrated terminal:
git status
git add
git commit -m "Refine session changes"
git push
Use your repository’s normal branch, commit, review, and approval practices. Because VS Code opened the worktree and branch associated with the session, pushing the branch updates the pull request already tracking that work.
There is no need to copy the finished files into another checkout or reconnect the work to the pull request manually.
A continuous workflow from agent to editor
Opening a Copilot app session in VS Code gives you a clean division of labor without splitting the work itself. Copilot can take on a larger or repetitive implementation, while you can move into the editor for detailed review, targeted changes, local testing, and final polish.
The session, diff, and worktree move with you. Start by directing the work in the Copilot app, switch to VS Code whenever you want hands-on control, and push the finished result through the same pull request workflow.
Ready to try it? Download the GitHub Copilot app , start a session, and open it in VS Code when you are ready to continue coding.
Written by
Senior AI Developer Tools Advocate
| 刊期 | 得分 | 排名 | 结果 |
|---|---|---|---|
| 2026-11-01 | 7.4 | 66 | 未入选 |
| 2026-10-31 | 7.4 | 76 | 未入选 |
| 2026-10-30 | 7.4 | 78 | 未入选 |
| 2026-10-29 | 7.4 | 69 | 未入选 |
| 2026-10-28 | 7.4 | 71 | 未入选 |
| 2026-10-20 | 9.79 | 24 | 入选 |