Using a codespace to work on a pull request gives you all the benefits of GitHub Codespaces. For more information, see GitHub Codespaces overview.
About pull requests in GitHub Codespaces
GitHub Codespaces provides you with many of the capabilities you might need to work with pull requests:
- Create a pull request - Using either the Terminal and Git commands or the "Source Control" view, you can create pull requests just as you would on GitHub. If the repository uses a pull request template, you'll be able to use this within the "Source Control" view.
- Open a pull request – You can open an existing pull request in a codespace, provided you have codespace access to the branch that is being merged in.
- Review a pull request - Once you have opened a pull request in a codespace, you can use the "GitHub Pull Request" view to add review comments and approve pull requests. You can also use GitHub Codespaces to view review comments.
Opening a pull request in Codespaces
-
Under your repository name, click Pull requests.
-
In the list of pull requests, click the pull request you'd like to open in Codespaces.
-
On the right-hand side of your screen, click Code.
-
In the Codespaces tab, click .
A codespace is created for the pull request branch and is opened in your default editor for GitHub Codespaces.
Reviewing a pull request in Codespaces
-
With your default editor set to either Visual Studio Code or Visual Studio Code for Web, open the pull request in a codespace, as described in Opening a pull request in Codespaces previously in this article.
-
In the Activity Bar, click the Git pull request icon to display the "GitHub Pull Request" side bar. This icon is only displayed in the Activity Bar when you open a pull request in a codespace.
If you opened a pull request in a codespace and the pull request icon is not displayed in the Activity Bar, make sure you are signed in to GitHub. Click the GitHub icon in the Activity Bar then click Sign in.
-
To review the changes that have been made to a specific file, click the file's name in the "GitHub Pull Request" side bar.
This displays a diff view in the editor, with the version of the file from the base branch on the left, and the new version of the file, from the head branch of the pull request, on the right.
-
To add a review comment, click the + sign next to the line number in the file displayed on the right side of the editor.
-
Type your review comment and then click Start Review.
-
Optionally, you can suggest a change that the author of the pull request can click to commit if they agree with your suggestion. To do this, click and hold the + sign next to the first line you want to suggest changing, then drag the + sign to the last line you want to suggest changing. Then click Make a Suggestion in the comment box that's displayed.
The lines you selected are copied into the comment box, where you can edit them to suggest a change. You can add a comment above the line containing
```suggestion
to explain your suggested change.Click Add Comment to add your suggestion to the pull request.
-
When you are finished adding review comments, you can add a summary comment for your pull request review in the "GitHub Pull Request" side bar. You can then click Comment and Submit, or click the dropdown arrow and select Approve and Submit or Request Changes and Submit.
For more information on reviewing a pull request, see Reviewing proposed changes in a pull request.
View comments from a review in Codespaces
Once you have received feedback on a pull request, you can open it in a codespace in your web browser, or in VS Code, to see the review comments. From there you can respond to comments, add reactions, or dismiss the review.