[DL.CR.6] Initiate code reviews using pull requests
Category: RECOMMENDED
Pull
requests are a method of integrating changes from one
branch of a repository into another. They can be used to
propose, review, and integrate changes from a feature branch
into the main releasable branch. Modern branching strategies,
including
GitHub
flow
A pull request workflow is recommended for organizations and teams which have
enhanced code review requirements. This workflow could include requiring multiple peer
reviewers, or enforcing that reviews must take place before code is integrated into the
main releasable branch. We recommend adopting trunk-based development paired with a pull
request workflow utilizing short-lived
feature branches
There should be clearly defined steps to standardize creating, reviewing, and merging pull requests. Store these guidelines in a shared, easily accessible location to ensure all team members understand the process. The guidelines should include:
-
Useful descriptions and titles: The pull request descriptions should guide the reviewer through the changes, grouping related files and concepts. A well-crafted title gives a high-level summary of the changes, providing the reviewer with the necessary context.
-
Descriptive commit messages: Each commit message should clearly communicate what changed and why. This can make auto-generated pull requests more useful, provide a bullet-point summary of the changes, and aid reviewers who read the commits along with the diff.
-
Inline comments: Leaving comments on the pull request can guide the reviewer through the changes. These comments can provide the reviewer with the necessary context, such as files that were simply re-indented or files where the main bulk of changes occurred.
-
Visual cues: For user interface (UI) changes, consider including screenshots, GIFs, or videos. Visual representations can make it easier for reviewers to understand the changes.
Pull request workflows are recommended, but not strictly
required for DevOps adoption. Some organizations and smaller
teams may choose to strictly follow trunk-based development
practices and commit
changes directly
to the main releasable branch
Related information: