How to Use GitHub Copilot to Level Up Your Code Reviews and Pull Requests
Melissa Pastore walks through hands-on methods for using GitHub Copilot to streamline code reviews and pull requests, offering actionable workflow tips and Copilot prompt examples based on her engineering experience at GitHub.
How to Use GitHub Copilot to Level Up Your Code Reviews and Pull Requests
By Melissa Pastore
Since joining GitHub’s billing team, I’ve observed the rapid evolution of AI-powered coding tools, especially GitHub Copilot. This article explores how Copilot extends far beyond code completion and now supports a wide range of engineering tasks, particularly around code reviews and pull requests (PRs).
Copilot in the Code Review Workflow
Copilot has become a valuable asset at every stage of the software development lifecycle. Here are some techniques I use to incorporate Copilot into my workflow:
1. Generating Code Review Suggestions
- While reviewing teammates’ PRs, I use Copilot to suggest improvements for specific code blocks.
- For example, if I spot repetitive Ruby code, I prompt Copilot with “Can you refactor this Ruby on Rails code to reduce repetition?” and include its suggestion in my code review comments.
- Copilot helps ensure best practices are followed, even when reviewing code in multiple languages like Ruby, TypeScript, or Go.
- Example prompt for Go: “Is this code addition following Go best practices for variable assignment? If not, can you suggest improvements?”
2. Automated Formatting for Data and Documentation
- Copilot is useful for turning spreadsheet data or performance results into Markdown tables for PR descriptions.
- Sample prompt: “Format this data into a GitHub flavored markdown table that I can paste into a GitHub pull request description…”
- Copilot generates ready-to-use Markdown, making it easier to communicate data in reviews.
3. Drafting Pull Request Summaries
- Copilot can generate initial summaries for PR descriptions, providing a starting point for documentation even when I’m in a hurry or facing writer’s block.
- Using the Copilot icon in the pull request editor streamlines summarizing changes.
4. Reviewing and Explaining Unfamiliar Code
- Before marking a PR as ready, I ask Copilot to review my own changes for potential improvements or missed issues.
- For unfamiliar changes made by others, Copilot explanations help me quickly grasp context and potential impact, making my feedback more effective.
Copilot’s Impact on Developer Productivity
- Copilot streamlines code suggestions, refactors, Markdown formatting, and summary generation—freeing up time for high-level engineering work.
- Its integration across the software lifecycle transforms how developers collaborate and review code.
Getting Started
To explore these features, try GitHub Copilot in your own development and code review workflows.
About the Author: Melissa Pastore is a software engineer on GitHub’s billing team and a frequent user of Copilot in daily engineering tasks.
This post appeared first on “The GitHub Blog”. Read the entire article here