Skip to content

Commit ab3a31e

Browse files
Using git agent for code review (new feature) (#15397)
* Using git agent for code review (new feature) * Apply suggestion from @ghogen * Restore Git Changes section * Remove duplicated lines Removed redundant instructions for reviewing changes with Copilot. * Fix warning * Update docs/version-control/git-make-commit.md Co-authored-by: learn-build-service-prod-09[bot] <274431102+learn-build-service-prod-09[bot]@users.noreply.github.com> --------- Co-authored-by: learn-build-service-prod-09[bot] <274431102+learn-build-service-prod-09[bot]@users.noreply.github.com>
1 parent eeae0ff commit ab3a31e

4 files changed

Lines changed: 51 additions & 11 deletions

File tree

docs/ide/copilot-specialized-agents.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: mikejo
88

99
ms.subservice: ai-tools
1010
ms.collection: ce-skilling-ai-copilot
11-
ms.custom: awp
11+
ms.custom: awp, doc-kit-assisted
1212
ai-usage: ai-assisted
1313
ms.update-cycle: 180-days
1414
monikerRange: '>= vs-2022'
@@ -52,6 +52,7 @@ Each built-in agent focuses on a specific developer workflow. These agents integ
5252
| Agent | Description |
5353
| ----- | ----------- |
5454
| **@debugger** | Goes beyond reading error messages. Uses your call stacks, variable state, and diagnostic tools to walk through error diagnosis systematically across your solution. |
55+
| **@git** | Reviews your local uncommitted changes and surfaces feedback as inline comments in the editor and in the Git Changes experience. |
5556
| **@profiler** | Connects to Visual Studio's profiling infrastructure to identify bottlenecks and suggest targeted optimizations grounded in your codebase, not generic advice. |
5657
| **@test** | Generates unit tests tuned to your project's framework and patterns, not boilerplate that your CI rejects. |
5758
| **@modernize** | (.NET and C++ only) Handles framework and dependency upgrades with awareness of your actual project graph. Flags breaking changes, generates migration code, and follows your existing patterns. |
@@ -65,6 +66,8 @@ Each built-in agent focuses on a specific developer workflow. These agents integ
6566
| ----- | ----------- |
6667
| **@profiler** | Connects to Visual Studio's profiling infrastructure to identify bottlenecks and suggest targeted optimizations grounded in your codebase, not generic advice. |
6768

69+
::: moniker-end
70+
6871
:::moniker-end
6972

7073
:::moniker range="visualstudio"
@@ -85,6 +88,23 @@ The @debugger agent helps you diagnose errors systematically by analyzing your d
8588

8689
::: moniker-end
8790

91+
:::moniker range="visualstudio"
92+
93+
### Use the @git agent
94+
95+
Use the @git agent to review local uncommitted changes without leaving Copilot Chat.
96+
97+
**Example prompts**:
98+
99+
+ `@git Review my changes`
100+
+ `@git Explain this review comment and suggest a fix`
101+
102+
:::image type="content" source="../version-control/media/visualstudio/git-agent-code-review-icebreaker.png" alt-text="Screenshot showing Copilot Chat with the Git agent and Review changes option highlighted.":::
103+
104+
For the full local review workflow, see [Review local changes with Copilot Chat](../version-control/git-make-commit.md#review-local-changes-with-copilot-chat).
105+
106+
::: moniker-end
107+
88108
### Use the @profiler agent
89109

90110
The @profiler agent connects to Visual Studio's profiling tools to help identify and fix performance issues.

docs/version-control/git-make-commit.md

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,25 +137,29 @@ The **Git Changes** window also shows a list of all Copilot review comments, org
137137

138138
![Screenshot showing code review comments for each file in the Git Changes window.](./media/visualstudio/local-code-review-comment-list-cropped.png)
139139

140-
:::moniker-end
140+
#### Review from the Git agent in Copilot Chat
141141

142-
:::moniker range="vs-2022"
142+
In Copilot Chat, switch to the **Git** agent. You can select it from the agent picker or type `@git` in the chat input.
143143

144-
In the **Git Changes** window, select the **Review changes with Copilot** button, which looks like a comment icon with a sparkle.
144+
![Screenshot showing the Git agent description card in Copilot Chat.](./media/visualstudio/git-agent-code-review-description.png)
145145

146-
After a few moments, a link showing the number of code review comments appears in the **Git Changes** window that you can select to view and navigate the comments. If no issues are detected, the message **Copilot did not comment on any files** appears.
146+
Ask the agent to review your changes. You can use the suggested **Review changes** prompt or type your own.
147147

148-
![Screenshot showing Git Changes window with Review changes button.](./media/vs-2022/git-code-review-changes-button.png)
148+
![Screenshot showing Copilot Chat with the Git agent and Review changes option highlighted.](./media/visualstudio/git-agent-code-review-icebreaker.png)
149149

150-
The code review feedback shows up as comments, which show brief summary of the potential problem, and you can decide to make a change, or dismiss the comment box by using the up arrow button on the top right of the comment box.
150+
The agent analyzes your uncommitted changes by using GitHub Copilot code review. After the service returns a result, a link showing the number of code review comments appears in the **Git Changes** window. Select the link to view and navigate comments. If no issues are detected, the message **Copilot did not comment on any files** appears.
151151

152-
![Screenshot showing GitHub code review comment.](./media/vs-2022/git-code-review-comment.png)
152+
The review feedback appears inline in the editor and in the **Git Changes** comment list. You can continue the conversation in chat to ask for explanations, discuss findings, and work through suggested edits.
153153

154-
To remove all comments, use the **X** in the Git Changes window to close the Copilot code review link.
154+
![Screenshot showing an inline code review comment from the Git agent in the editor.](./media/visualstudio/git-agent-code-review-comment-2.png)
155155

156-
:::moniker-end
156+
To remove all comments, use the **X** in the **Git Changes** window to close the Copilot code review link.
157157

158-
:::moniker range="visualstudio"
158+
##### Navigate comments for Git agent reviews
159+
160+
The **Git Changes** window also shows a list of all Copilot review comments, organized by file. You can double-click any comment in the list to navigate directly to that comment located inline with the corresponding code in the editor.
161+
162+
![Screenshot showing code review comments for each file in the Git Changes window.](./media/visualstudio/local-code-review-comment-list-cropped.png)
159163

160164
### Apply suggestions from local code review
161165

@@ -171,6 +175,22 @@ You can also apply code suggestions from [pull request comments](git-create-pull
171175

172176
:::moniker-end
173177

178+
:::moniker range="vs-2022"
179+
180+
In the **Git Changes** window, click on the **Review changes with Copilot** button, which looks like a comment icon with a sparkle.
181+
182+
After a few moments, a link showing the number of code review comments appears in the **Git Changes** window that you can click on to view and navigate the comments. If no issues are detected, the message **Copilot did not comment on any files** appears.
183+
184+
![Screenshot showing Git Changes window with Review changes button.](./media/vs-2022/git-code-review-changes-button.png)
185+
186+
The code review feedback shows up as comments, which show brief summary of the potential problem, and you can decide to make a change, or dismiss the comment box by using the up arrow button on the top right of the comment box.
187+
188+
![Screenshot showing GitHub code review comment.](./media/vs-2022/git-code-review-comment.png)
189+
190+
To remove all comments, use the **X** in the **Git Changes** window to close the Copilot code review link.
191+
192+
:::moniker-end
193+
174194
## Revert, reset, or amend a commit
175195

176196
When you double-click a **Commit**, Visual Studio opens its details in a separate tool window. From here you can revert the commit, reset (undo) the commit, amend the commit message, or create a tag on the commit. When you select a changed file in the commit, Visual Studio opens the side-by-side **Diff** view of the commit and its parent.
11 KB
Loading
13 KB
Loading

0 commit comments

Comments
 (0)