Collaborative Code Reviews: Mastering Feedback and Suggestions
Master the art of collaborative code reviews. Learn to use line-by-line comments and suggest code changes directly in GitHub to streamline your team workflow.

Previously in this course, we explored analyzing repository health to understand team engagement. Now that you know how to track project metrics, it’s time to get hands-on with the most critical aspect of engineering quality: the code review.
Effective collaboration via a pull request is not just about catching bugs. It is a communication tool that ensures the codebase remains maintainable and that knowledge is shared across the team.
The Mechanics of Effective Feedback
When you open a pull request, you are inviting your peers to scrutinize your work. To turn this into a productive dialogue, you need to master two primary GitHub features: line-by-line commenting and the "Suggested Changes" tool.
Using Line-by-Line Comments
Generic feedback like "this looks weird" is rarely helpful. Context is everything. In GitHub, you can comment on specific lines of code to ensure the author knows exactly which logic needs attention.
- Navigate to the Files changed tab in your PR.
- Hover over the line number you want to discuss.
- Click the + icon that appears.
- Write your feedback, framing it as a question or a suggestion rather than a command.
Pro-tip: Use the "Start a review" button instead of clicking "Add single comment." This allows you to batch all your comments into a single notification, preventing you from "pinging" your teammate every time you type a sentence.
Suggesting Changes via GitHub
Sometimes, the most efficient way to communicate a fix is to write the code yourself. GitHub allows you to provide a "Suggested Change" that the author can accept with a single click.
- Open the comment box on a specific line of code.
- Click the Add suggestion icon (it looks like a plus sign inside a box) in the toolbar.
- GitHub will wrap your suggestion in a code block. Edit the code inside that block to match your recommended implementation.
- When you submit your review, the author will see a button labeled Commit suggestion.
| Action | Best Used When... |
|---|---|
| Line Comment | You need clarification or have a design concern. |
| Suggestion | You have a specific, minor code improvement. |
| Review Summary | You are ready to provide an overall "Approve" or "Request Changes." |
Worked Example: Providing Constructive Feedback

Imagine your teammate has submitted a PR that uses a hardcoded URL. You want to suggest using an environment variable instead.
Step 1: Navigate to the PR, go to Files changed, and locate the line with the hardcoded string. Step 2: Click the + icon and write your comment: "I think we should move this to a configuration file to avoid hardcoding secrets. What do you think?" Step 3: Click the Add suggestion button and modify the code block:
SUGGESTIONconst API_URL = process.env.API_URL;
Step 4: Click Start a review, add your final summary, and select Request changes if the issue is critical, or Comment if you are just suggesting an improvement.
Hands-on Exercise: Review Simulation
- Create a new branch in your project and make a small change to a file (e.g., add a comment or change a variable name).
- Open a Pull Request for this branch.
- In a separate browser window (or ask a friend), go to your own PR.
- Leave a line-by-line comment on your change.
- Use the Add suggestion feature to propose a slight improvement to your code.
- Return to your original account, navigate to the PR, and click Commit suggestion to see how it updates your branch automatically.
Common Pitfalls to Avoid
- Reviewing without context: Always read the PR description first. If you don't understand the "why," ask for clarification before critiquing the "how."
- Bike-shedding: As discussed in our look at bike-shedding in code reviews, avoid getting hung up on trivial formatting issues. Use automated linters for that.
- Tone deafness: Remember there is a human on the other side. Use "we" and "us" rather than "you" to foster a building quality culture mindset.
- Ignoring the "Resolve conversation" button: Once you've discussed a point, make sure to click "Resolve conversation" so the PR interface stays clean and focused on remaining issues.
Frequently Asked Questions
Q: Should I always use "Request Changes" if I have a comment? A: No. Reserve "Request Changes" for code that is broken, insecure, or violates project standards. Use "Comment" for minor suggestions or questions.
Q: Can I edit a suggestion after I've submitted the review? A: Once a review is submitted, you cannot edit the text of the suggestion. If you made a mistake, reply to your own comment with a correction.
Q: What if the author disagrees with my suggestion? A: That’s part of the process! Discuss it in the thread. If you can't reach a consensus, bring in another team member or follow your team's mandatory reviewers policy.
Recap

Mastering collaborative code reviews requires balancing technical precision with clear, empathetic communication. By using line-by-line comments for context and the suggestion tool for direct code improvements, you ensure that every code review adds value to the project and builds stronger team alignment.
Up next: We will learn how to handle large files in your repository using Git LFS.



