Photo by Aliya Amangeldi on Unsplash
How to Write Pull-Requests Like A Badass
Because nobody wants to review your 50-file change pull-request. Nobody.
3 min read
A pull request is a common feature in collaborative software development, and it allows team members to suggest changes to a project's codebase. Writing a good pull request can help to ensure that your changes are accepted and incorporated into the project smoothly. Basically, it's just being a good teammate 😎
Here are some tips for writing a good pull request:
Keep your changes small and focused (most important)
Large pull requests can be difficult to review and can often contain a lot of unnecessary or irrelevant changes. Instead, try to keep your changes small and focused on a specific problem or issue. This will make it easier for reviewers to understand and evaluate your changes. Nobody wants to review your 50-file change PR.
Provide a clear and concise description of your changes
The first thing that reviewers will see when they look at your pull request is the description. Make sure that your description clearly explains what you have changed and why. This will make it easier for reviewers to understand your changes and evaluate their impact on the project. However, the goal here is concise. Do not write a novel. This is not War and Peace.
Include relevant context and background information
If your changes are related to a specific issue or problem, be sure to include this information in your pull request. This will help reviewers to understand the rationale behind your changes and how they fit into the overall project. You can also drop a link to a JIRA ticket if that's the particular flavor of hell your org has chosen for managing projects.
Test your changes thoroughly
Before submitting your pull request, make sure that you have tested your changes thoroughly. This will help to ensure that your changes do not introduce any new bugs or regressions. If possible, include test results or other evidence of your testing in your pull request.
Be open to feedback and suggestions
Nobody is perfect. Pull request reviews are an opportunity for your peers to provide feedback and suggestions for improvement. Be open to their suggestions and be willing to make changes based on their feedback. This will help to ensure that your changes are of high quality and will be accepted by your peers.
By following these tips, you can write pull requests that are clear, concise, and easy to review. This will help to ensure that your changes are accepted and incorporated into the project smoothly.
The old adage, "pretend as though the person who has to read your code has an axe and knows where you live," can also apply to pull requests. 🙃