Skip to main content

Pull Request Reference

What is a pull request?

A Pull Request (PR) is a way to get your changes integrated into protected branches, making sure the changes fulfill a defined set of policies or quality gates.

Where should a pull request be used?

A pull request is used from a feature branch to a protected branch, typically to the development/integration or master/main branch. Direct commits are possible only on feature branches.

If someone attempts to commit code changes on a protected branch, git reminds the user that it's not possible and that a pull request must be used instead.

Mandatory policies

  • Require a minimum number of reviewers to approve, typically 1 or 2 Code Guards
  • A person cannot approve his/her own code changes
  • A description of the content to integrate is provided by the person who creates the pull request
  • All comments must be resolved
  • Changes must be linked to a work item
  • Build validation

Optional policies

Customizing pull requests

A pull request template can be used to define a standard pull request description and checklist format. Azure DevOps PR template documentation

Who can approve a pull request?

The people who can approve a pull request are sometimes called Code Guards or Committers.

Pull Requests to dev/integration (or master if following a GitHub flow) should be approved by someone in the development team, but an engineer cannot approve his/her own pull request.

  • In some cases, anyone can contribute to a repository, but only a few selected people have the authority to approve/reject those contributions.
  • In some cases, any team member can approve/reject a code change, and the pull request becomes a way to ensure that the code is reviewed by at least one person other than the author before it is accepted.

It is possible to automatically add reviewers to pull requests that change files in specific directories and files or to all pull requests in a repo: https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops&tabs=browser#automatically-include-code-reviewers

Pull Requests to Master (in the recommended Gitflow branch model) shall be approved by someone in the CM group or the Product Owner.

How to review the changes?

See the Code Review guideline.

Owner: Configuration Management Team