In Software Development By Leigh Halliday November 29, 2014 Leigh Halliday

Pull Requests for Quality, Training, and Shared Knowledge

Intro To Pull Requests

A pull request is when you are wanting to merge code from one git branch to another, and instead of just merging it yourself, you send a request to another developer to review the changes and merge the code into the desired branch.

Pull requests-at least in GitHub-offer a great way to review the changes, discuss them, and also leave comments directly tied to a specific line of code.

In open source projects, pull requests are quite commonplace, as only a single (or maybe a few) developer(s) have the ability to merge code into the repository.

Where I currently work, no code is allowed to enter the develop branch (future production code) without having been merged by a pull request. No matter how senior a developer, or how small of an issue, having it done this way brings about many benefits, a few of which I will discuss below.

For Quality

Pull requests improve the quality of the code because they allow another set of eyes to view the code before it is merged into a main branch. Often when I submit a pull request, the developer who is handling it can offer suggestions on how to clean up the code, and notify me if they see areas that might be either buggy or not sufficiently tested. It ensures that no code enters production without having been viewed by at least 2 developers, even when it wasn't written by pair programming.

For Training

Pull requests are a great training and teaching tool, both for the person reviewing the PR and also for the submitter. I regularly learn new and better ways to solve problems when I am reviewing others' pull requests. Everyone has different skill-sets, so by reviewing code coming from another developer, you are going to learn new things, and therefore become a more balanced developer.

For Knowledge Sharing

In a large codebase, there are inevitably areas of the code that you aren't completely familiar with. When you are able to review someone's pull request, you get an inside view into that area of the code. It helps spread the domain knowledge amongst the entire team.

Conclusion

I encourage you and your team to try using pull requests. They help improve the quality of the code, offer great training to developers, and help spread domain knowledge among the entire team.