Skip to content

Commit f7a748f

Browse files
Learn Build Service GitHub AppLearn Build Service GitHub App
authored andcommitted
Merging changes synced from https://github.com/MicrosoftDocs/visualstudio-docs-pr (branch live)
2 parents 7900e77 + b316c8f commit f7a748f

File tree

8 files changed

+106
-0
lines changed

8 files changed

+106
-0
lines changed

docs/ide/copilot-edits.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: 'GitHub Copilot Edits (Preview) in Visual Studio'
3+
description: Use GitHub Copilot Edits (Preview) to iterate quickly on code changes across multiple files in Visual Studio version 17.13 Preview 2 and later.
4+
ms.date: 1/16/2025
5+
ms.topic: overview
6+
author: anandmeg
7+
ms.author: meghaanand
8+
ms.manager: mijacobs
9+
ms.subservice: ai-tools
10+
ms.collection: ce-skilling-ai-copilot
11+
monikerRange: '>= vs-2022'
12+
---
13+
# What is GitHub Copilot Edits (Preview)?
14+
15+
GitHub Copilot Edits, a preview feature of GitHub Copilot Chat, is designed to help iterating across multiple files more efficient. This feature is available as a preview experience in Visual Studio 2022 version 17.13 Preview 2 and later.
16+
17+
Edits combines the conversational flow of chat and an inline review experience, offering the following benefits:
18+
- **Preview with clarity**: Know exactly what's being modified with a summary of the affected files and the proposed changes.
19+
- **Review with flow**: View code diffs inline, directly in your editor. Use the `TAB` key to accept or the `Alt+Del` key to reject individual changes, or apply/dismiss all at once.
20+
- **Iterate with confidence**: Use checkpoints to revisit earlier iterations of a code file or try an alternative approach anytime for new ideas.
21+
22+
## Prerequisites
23+
24+
+ [Visual Studio 2022 version 17.13 Preview 2](/visualstudio/releases/2022/release-history) or later.
25+
+ [Sign in to Visual Studio using a GitHub account](work-with-github-accounts.md) with [Copilot access](https://docs.github.com/en/copilot/about-github-copilot/what-is-github-copilot#getting-access-to-copilot). <br/>
26+
+ You can use [GitHub Copilot for Free](copilot-free-plan.md). Sign up and leverage AI to code faster and more efficiently.
27+
28+
## When to use Copilot Edits vs. Copilot Chat
29+
30+
31+
| Functionality | Copilot Chat | Copilot Edits |
32+
| ------------- | ------------- | ------------- |
33+
| Primary use case | **General purpose** conversational interface for understanding programming concepts, asking questions about code, and generating code. | **Focused multi-file editing** interface with code review, in-file preview, and rollback experience to make iterating on code across multiple files easier. |
34+
| Previewing proposed code | **Manually apply** each code block to each file in your solution to evaluate code-diff. | **Automatically applies** proposed code diff in each code file, making comprehension of the proposed changes easier.|
35+
| Code review experience | Accept or reject a **file worth of changes** at once. | Accept or reject **individual chunks of code** within a file. |
36+
| Versioning | Can use existing version control. | Adds a **rollback experience** to reset edited files to a previous state. Tracks all changes - proposed, accepted, dismissed, and manual edits made to the file. These checkpoints are retained until the user closes Visual Studio. |
37+
38+
## Using Copilot Edits
39+
40+
### Start an Edits thread
41+
42+
:::image type="content" source="media/vs-2022/copilot-edits/getting-started-with-edits.gif" alt-text="Animated screenshot that shows starting a Copilot Edits thread and getting a response." lightbox="media/vs-2022/copilot-edits/getting-started-with-edits.gif":::
43+
44+
1. Select **View** > **GitHub Copilot Chat** to launch GitHub Copilot Chat. You can also launch it from the GitHub Copilot status icon.
45+
2. Select **Create new Edit session** to create a new Edits thread.
46+
47+
3. Enter a chat prompt using natural language about the specific edit you want to make. To help Copilot Edits provide better code suggestions, you can also add relevant context to your prompt. [Reference context](copilot-chat-context.md#reference) by typing the `#` commands to refer to a file, your solution, errors, or a symbol specifically.
48+
49+
> [!TIP]
50+
> We suggest you ask for one commit’s worth of changes at a time. The more you can break down a problem, the better the result.
51+
52+
### Accept or discard edits
53+
54+
After Copilot Edits proposes a code iteration, you can preview these suggestions in your code files. You can then **Accept** to commit the proposed changes.
55+
56+
#### Review each proposed change
57+
58+
:::image type="content" source="media/vs-2022/copilot-edits/accept-by-chunk.gif" alt-text="Animated screenshot that shows applying edits to file and accepting by chunk." lightbox="media/vs-2022/copilot-edits/accept-by-chunk.gif":::
59+
60+
+ Start by clicking on a filename.
61+
+ The file opens and proposed changes are displayed as a diff in the code editor.
62+
63+
+ Use `TAB` to accept a proposal, `Alt+Del` to reject a proposal, or `F8` to go to the next proposal.
64+
65+
+ If you accept or reject a proposal, the cursor will automatically move to the next proposal.
66+
67+
#### Accept all proposed changes in a file
68+
69+
:::image type="content" source="media/vs-2022/copilot-edits/accept-file.gif" alt-text="Animated screenshot that shows accepting edits to a specific file." lightbox="media/vs-2022/copilot-edits/accept-file.gif":::
70+
71+
72+
Click the checkbox next to a filename to accept all proposed changes specific to a file.
73+
74+
#### Accept all proposed changes in all files
75+
76+
:::image type="content" source="media/vs-2022/copilot-edits/accept-all.gif" alt-text="Animated screenshot that shows accepting all edits on all files." lightbox="media/vs-2022/copilot-edits/accept-all.gif":::
77+
78+
Select **Accept all** to accept the proposed code changes across all files where changes are available. Files with proposed changes are bolded.
79+
80+
### Revert edits
81+
82+
#### Revert to the original state
83+
84+
:::image type="content" source="media/vs-2022/copilot-edits/reset-iteration.png" alt-text="Screenshot that shows reverting file to the original state before any edits." lightbox="media/vs-2022/copilot-edits/reset-iteration.png":::
85+
86+
While reviewing file changes, if you accept or reject a code proposal you didn't mean to, select **Reset changes** to reset the listed files to their state before the iteration was generated.
87+
88+
Reset changes also resets any manual changes made to the files.
89+
A popup dialog confirms the action before reverting file states
90+
91+
### Revert to a previous iteration
92+
93+
:::image type="content" source="media/vs-2022/copilot-edits/reset-to-previous-iteration.png" alt-text="Screenshot that shows reverting file to a previous iteration." lightbox="media/vs-2022/copilot-edits/reset-to-previous-iteration.png":::
94+
95+
96+
At any time, you can select the **Reset to Iteration** on a previous iteration to reset all proposed and manual changes made to the listed files.
97+
A popup dialog confirms the action before reverting file states.
98+
99+
## Related content
100+
101+
- [Install and manage GitHub Copilot in Visual Studio](visual-studio-github-copilot-install-and-states.md)
102+
- [GitHub Copilot experience for Visual Studio](visual-studio-github-copilot-extension.md)
103+
- [GitHub Copilot Chat experience for Visual Studio](visual-studio-github-copilot-chat.md)
104+
- [About GitHub Copilot Free](https://aka.ms/ghdocscopilotfreepage)
359 KB
Loading
394 KB
Loading
303 KB
Loading
2.65 MB
Loading
298 KB
Loading
326 KB
Loading

docs/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@
149149
href: ide/visual-studio-github-copilot-chat.md
150150
- name: Tips to improve Copilot Chat results
151151
href: ide/copilot-chat-context.md
152+
- name: Copilot Edits (Preview)
153+
href: ide/copilot-edits.md
152154
- name: Debug with GitHub Copilot
153155
href: debugger/debug-with-copilot.md
154156
- name: Deploy GitHub Copilot to your enterprise

0 commit comments

Comments
 (0)