Skip to content

Commit ed0f68f

Browse files
authored
Merge pull request #13501 from ghogen/pr-comments
Add PR comment feature
2 parents 1b12bcc + 03446d4 commit ed0f68f

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

docs/version-control/git-create-pull-request.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Create a pull request in Visual Studio
33
titleSuffix: ""
44
description: Create a pull request in Visual Studio by using GitHub or Azure DevOps.
5-
ms.date: 1/7/2025
5+
ms.date: 1/13/2025
66
ms.topic: how-to
77
author: ghogen
88
ms.author: ghogen
@@ -61,18 +61,42 @@ To create a pull request, follow these steps:
6161

6262
With Visual Studio 17.12 and later, you can enable the **Pull Request Templates** feature (in **Tools** > **Options** > **Environment** > **Preview Features**) so that your default PR template in your repo will be used when creating a new pull request for both GitHub and Azure DevOps. Learn more about how to add a pull request template to your repository in the [GitHub documentation](https://docs.github.com/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository) and [Azure DevOps documentation](/azure/devops/repos/git/pull-request-templates#default-pull-request-templates).
6363

64-
## View pull request comments in the editor
64+
## View or add pull request comments in the editor
6565

66-
As of Visual Studio 17.11, you can view comments and suggestions from reviewers without switching contexts to the browser.
66+
With Visual Studio 17.11 or later, you can view comments and suggestions from reviewers without switching contexts to the browser.
6767

6868
![Screenshot showing PR comments.](./media/vs-2022/git-pull-request-comments.png)
6969

7070
To enable this feature, open **Tools** > **Options** > **Preview features** and make sure that **Pull Request Comments** is selected.
7171

72+
### View pull request comments
73+
7274
To view the comments for a pull request, check out any branch with an active pull request branch and select **Show comments in files** from the infobar. You can also select the PR number in the **Git Changes** window or from the Git top level menu with **Git** > **GitHub** or **Azure DevOps** > **Show comments in files**.
7375

7476
![Screenshot showing link to view comments in Git Changes window.](./media/vs-2022/git-pull-request-link-and-PR-number.png)
7577

78+
### Add pull request comments
79+
80+
With Visual Studio 17.13 or later, you can review a pull request, or add comments.
81+
82+
To enable this feature, open **Tools** > **Options** > **Preview features** and make sure that **Pull Request Comments** is selected. Once these are activated, checkout any branch with an active pull request and click on **Show comments in files** in the infobar, and navigate through the changes using the toolbar buttons above the code file.
83+
84+
To add a comment, click on the **Add comment** icon to the left side of the editor, as shown in the following screenshot.
85+
86+
![Screenshot showing the Add comment icon when reviewing a file change in a pull request.](./media/vs-2022/pull-request-add-comment.png)
87+
88+
You can also right-click on a line of code and, on the context menu, choose **Git** > **Add comment**.
89+
90+
The comment text is not published until you click the **Add Comment** button on the comment window.
91+
92+
You can continue the conversation on an existing comment by using the **Reply** section in the comment box. Comments are either active or resolved. You can click **Reply and Resolve** to reply to a comment and change the status to resolved in one click, or change the status using the dropdown above the comment text.
93+
94+
You can toggle your like status on a comment by clicking on the icon, or by clicking on the three dots, you can copy the comment text to the clipboard, copy a link to the comment to the clipboard, delete the comment, or open the comment in the web browser at the provider's site (such as github.com or your Azure DevOps project site).
95+
96+
The ability to add comments to a pull request is limited for some Git providers. For example, with GitHub as the provider, you can only add comments on lines within 3 lines of a change, but with the Azure DevOps provider, you can add comments at any line of a file involved in the pull request. In any case, you can only add comments on files that are included in the pull request.
97+
98+
### Use the keyboard
99+
76100
You can navigate across files and individual comments using the icons in the toolbar, or use the following keyboard shortcuts:
77101

78102
| Action | Keyboard shortcut |
@@ -81,6 +105,7 @@ You can navigate across files and individual comments using the icons in the too
81105
| Go to the next file in the pull request | **Ctrl**+**Alt**+**F6** |
82106
| Go to the previous comment | **Ctrl**+**Shift**+**Alt**+**F8** |
83107
| Go to the next comment | **Ctrl**+**Alt**+**F8** |
108+
| Hide comments in files | **Ctrl**+**Shift**+**F1** |
84109

85110
## Next steps
86111

124 KB
Loading

0 commit comments

Comments
 (0)