Commenting on multiple lines of code during a code review on GitHub can improve the clarity and effectiveness of feedback. This guide explains the steps and tools necessary to make multi-line comments within GitHub pull requests.
Prerequisites
Before you start, you need:
- A GitHub account.
- Access to a repository where you can review pull requests.
Step-by-step guide to commenting on multiple lines
Open the pull request: Navigate to the GitHub repository and select the pull request where you want to comment.
Start a review: Click on the "Files changed" tab, then find the specific file where you want to comment.
Select multiple lines: Click and drag your mouse over the line numbers on the left side of the code or text diff to highlight multiple lines. You can also hold the
Shift
key while clicking the starting and ending lines to select a range.Write your comment: After selecting the lines, a blue comment icon will appear. Click on this icon to open the comment box. Here, you can type your feedback that applies to all selected lines.
Submit review: Once you’ve added comments, scroll to the bottom of the pull request page and click on "Review changes" to submit your review with comments.
Using Graphite's PR inbox for multi-line comments
Graphite's PR inbox acts like an "email client" for your PRs, allowing you to stay organized and see which pull requests need your attention. It can be particularly helpful when managing large reviews or multiple repositories. Here’s how you can use it in conjunction with GitHub for multi-line comments:
Configure your inbox: Set up your default repositories in Graphite to automatically track and organize pull requests.
Navigate and review: Use Graphite’s navigation features to quickly find the PRs you need to review, and apply the same multi-line commenting process as in GitHub.
Customization and sharing: Customize your inbox sections for different needs, such as “Needs your review” or “Waiting for review.” You can also share these configurations with your team to ensure everyone is aligned.
Benefits of commenting on multiple lines
Commenting on multiple lines in a pull request can provide clearer, more context-specific feedback. This can help prevent misunderstandings and improve the quality of code reviews. Additionally, using tools like Graphite’s PR inbox can enhance this process by organizing your reviews efficiently and aligning team efforts.