A Checklist to create the best Pull Request

Pull requests, sometimes called merge requests, are an essential part of a teams workflow. It helps to catch bugs early and is a great way to learn and grow. There are a few things to consider in order to have an effective pull request.

Purpose

A pull request should have a single purpose. Don’t stuff random changes into your pull request and don’t solve two issues at the same time. If there are multiple issues, it’s harder to understand which issue a certain line is contributing to and to grasp the overall logic. Also, make sure to constrain the pull request to a maximum complexity and length. 500 changed LOC is a good upper bound.

Explanation

A pull request should have a meaningful title (naming the purpose) and a proper description. It should describe what you are doing and why you are doing it in this way. If your pull request is based on a proper ticket/issue (which it should) it is fine to just link the ticket to describe the what. Keep the reviewer in mind and help her to get started. The better you help her understand the context and your thoughts, the easier the review will be and the faster the pull request is merged.

Self Review

Review your own pull request before assigning the pull request to someone. You want to value the time of your reviewer and want to prevent unnecessary review cycles. So just after you created the pull request have a short read over your code. Are there any things that shouldn’t be there? Remove them. Did you find any bugs right away? Fix them. Try to get into the mindset of a reviewer. Are there any pieces that might take a second to understand? Just add a comment in the pull request yourself and try to help your reviewer out.

Assignment

Don’t let a pull request hang around just like this. Your task isn’t finished just by creating the pull request. It’s your code. You want it to be merged. Find yourself a reviewer. Get in contact and make sure there is one who wants to review it. Make sure your pull request is assigned to someone.

Communication

Most importantly: communicate! If you feel your reviewer is stuck get in touch. If you have any time constraints and need the pull request to get merged try to support and talk about it. Don’t be afraid to ask questions and try to be constructive (which obviously counts for both).