Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automatically assign code owners as pull request reviewers

This feature update was also published on the Bitbucket blog.

As your team and products expand, expertise in various areas of your code base may become distributed among different team members, or across teams. This can create challenges when trying to identify the best qualified people to assign as pull request reviewers.

We have a new solution for this in Bitbucket Cloud: You can now designate suggested reviewers for specific areas of the code base by adding a code owners configuration file to your repository. This file is a set of rules describing which people own specific paths/patterns in your repository. Based on these rules, Bitbucket can then automatically assign reviewers to a pull request based on which files are being modified.

When you create a new pull request, Bitbucket automatically checks whether a CODEOWNERS file exists in the .bitbucket directory of the repository. If the file is found, every rule in that file is compared to the diff of your pull request. For each matching rule, the users associated with it are automatically added as suggested reviewers.

Learn more about code owners


Flexible and powerful

The code owners syntax gives you the flexibility to assign individuals, groups or custom-defined teams as default reviewers for specific file paths or patterns. When working with groups and teams, you can specify how many reviewers to select, and how they should be chosen. Here are a few usage examples to get you started:

# .bitbucket/CODEOWNERS

# Default reviewers for files not matching patterns below

# Choose all members of a workspace group
*.js @workspace-slug/frontenders:all

# Choose group members tagged on the fewest open PRs
*.py @workspace-slug/backenders:least_busy(2)

# Choose randomly from a custom team (defined in teams.yaml)
*.tf @teams/sre-leads:random(2)

Ready to see code owners in action? Simply add a CODEOWNERS file to the .bitbucket directory in your repository, then open a new pull request.

To learn all about code owners syntax, check out the reference guide.


Get started with smarter code reviewer assignment

The code owners feature is available now for all teams using Bitbucket Cloud. We’re excited about the potential of this feature to help your teams do better, smarter code reviews. As always, please feel free to share your thoughts with us through the help ‘?’ menu > Give feedback.


Maksym Ivanchenko April 1, 2024

Is it possible to use these code owners in the merge check?

Dave Parrish _Atlassian_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 9, 2024

Hi @Maksym Ivanchenko 👋 We will be adding a merge check for code owners in the near future!

Vitalii Illarionov April 19, 2024

@Dave Parrish _Atlassian_why "username" or "email" is used in code owners? Both were removed from the API results (as far as I remember these properties were removed due to privacy conserns), so it's hard to understand what is the user's email (we have > 100 users, so you can understand that it will be pain to make a list of user's emails - admins can see emails in admin console). Why we cannot use "display_name" or "uuid" or "account_id" which we can get by API request?


Log in or Sign up to comment
AUG Leaders

Atlassian Community Events