According to GitHub, a pull request is a proposal to merge code changes into a project. Teams can discuss and review the changes on the pull request before merging them. The description appears in GitHub's Conversation tab alongside the timeline, comments, and reviews.
Google's CL description guide provides description criteria for a CL, which means change list. Google defines the CL description as a public record of the change. This record should explain what changed and why the change was made. The first-line, body, and label criteria below come from Google's CL guide.
The first line of a CL description
According to Google, the first line should briefly and concretely summarize the work done in the CL. It should be followed by a blank line. The first line also appears in summaries of version control history. It therefore needs to make sense independently of the rest of the description.
Google's criterion is that someone searching for code in the history should not have to read the CL itself or the entire description to understand what the change does or how it differs from other CLs. While asking for the first line to be kept short and focused, Google prioritizes clarity and usefulness for the reader.
According to the convention Google describes, the first line should be a complete sentence written in the imperative mood. When describing the deletion of an RPC and its replacement with another system, the guide gives an example sentence that expresses the work done in the imperative. The rest of the description does not have to be written in the same mood.
Which first lines fall short?
Google gives “Fix bug” as an inadequate CL description. The phrase does not specify which bug was addressed or what was done to fix it. Other phrases Google places in the same group include “Fix build”, “Add patch”, and “Phase 1”.
“Moving code from A to B”, “Add convenience functions”, and “kill weird URLs” are also among Google's inadequate examples. Google states that although these descriptions are short, they do not provide enough useful information. Some of the examples in the guide are real CL descriptions.
The change's context in the body
According to Google, the section after the first line should contain the details needed to understand the CL as a whole. This section can include a brief description of the problem being solved and the rationale for the chosen approach. If the approach has shortcomings, these should also be stated.
Google also asks authors to describe the context they had when making the change and the decisions that are not visible in the code. Code can show what the software does, but it may not reveal why it exists. Google states that this can make it harder for future developers to understand whether they can change the relevant code.
When relevant, bug numbers, benchmark results, and design links can also be added to the body of the description. Google notes that external links may not be visible to future readers because of access restrictions or retention policies. Whenever possible, it asks for the description to contain enough context for reviewers and future readers to understand the CL.
According to Google, small CLs also deserve attention to detail and context. In the guide's example of a small change, the first sentence states the work done. The explanation that follows gives the reason for the change and the context the reviewer needs.
Google's description examples
Google's example of a functionality change concerns an RPC server message freelist. The first line says that the size limit on the freelist has been removed. The section that follows explains that some servers use large messages and could benefit from reusing them.
The example description also explains that the freelist is enlarged and a goroutine is added to slowly free entries over time. This allows freelist entries on idle servers to be freed over time. Google states that the first words of the example describe the work done, while the rest explains the problem, the rationale for the solution, and some of the implementation details.
In the refactoring example, the first line describes constructing a Task with a TimeKeeper to use the TimeStr and Now methods. The body explains the addition of a Now method to Task and how the borglet() getter method can be removed. According to the example, the getter was used only by OOMCandidate to call borglet's Now method.