Operations 6 min read

Configuring OWNERS Files for Code Review in Git Repositories

This guide explains how to set up and manage OWNERS files in a Git repository to define file owners, enable OWNERS‑based code review, configure review rules, add or remove reviewers, and handle approval or rejection of changes, with practical examples and code snippets.

Continuous Delivery 2.0
Continuous Delivery 2.0
Continuous Delivery 2.0
Configuring OWNERS Files for Code Review in Git Repositories

1. Location

OWNERS configuration is based on the default branch; updating the OWNERS file on other branches has no effect.

The OWNERS file can be placed in any directory and applies to that directory and all its sub‑directories.

2. Syntax

Basic syntax: <user_name> or <*> .

Scope: the directory containing the OWNERS file and all its sub‑directories.

Example for specifying owners:

# use <user_name> format, set users for current dir
git_helper_01
git_helper_02

To ignore owners for a directory:

# use <*> format, ignore all file owners for current dir
*

3. OWNERS Review

The OWNERS file is used as the review configuration for a change request (CR); all files in the CR must pass OWNERS review for the CR to be approved.

3.1 Enable OWNERS Review

Navigate to Settings → Branch Rules (including protected branches) and select the appropriate review rule.

Check the option “Enable OWNERS review for files”.

3.2 Configure OWNERS Review Rules

Assign reviewers for a folder by listing <user_name> entries in an OWNERS file (e.g., git_helper_01 , git_helper_02 ).

Exclude folders from review by adding a single asterisk ( * ) in the OWNERS file.

3.3 Conduct OWNERS Review

When enabled, creating a CR automatically generates file‑level review rules based on the OWNERS configuration and suggests owners as reviewers.

To add reviewers, edit the reviewer list, open the OWNERS filter, and select the desired owners (or directly add <user_name> ).

To remove reviewers, modify the CR’s reviewer list; individual file‑level removal is not supported.

Approval or rejection must be applied to the entire CR, not to single files.

Review rules are immutable after CR creation; they are reset only when the CR is reopened or a new commit is added, using the latest OWNERS configuration.

4. Appendix

Comparison of .code.yml and OWNERS configurations, and examples of recommended reviewers for CRs based on the nearest OWNERS file.

Example OWNERS files:

owner_01
owner_02
owner_03
owner_04

When files /apps/test.go and /apps/main/test.go are changed, the system recommends owner_01 and owner_03 respectively as reviewers.

DevOpsCode ReviewGitRepository ManagementOWNERS
Continuous Delivery 2.0
Written by

Continuous Delivery 2.0

Tech and case studies on organizational management, team management, and engineering efficiency

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.