Skip to content

Using CODEOWNERS for Enforced Reviews

A CODEOWNERS file assigns responsibility for parts of the repository so GitLab can request approvals from the right people.

  1. Add a CODEOWNERS file in the repository root, docs/, or .gitlab/ directory.
  2. List file patterns followed by usernames or groups, for example:
    docs/* @technical-writers
    src/frontend/ @frontend-team
  3. Commit and push the file to the default branch.
  • Go to Settings > Repository > Protected branches and enable Require approval from code owners.
  • Merge requests that touch owned files will require approval from listed owners before merging.
  • Keep patterns as specific as possible to avoid unexpected approvals.
  • Use groups rather than individual usernames for easier maintenance.
  • Review ownership regularly as teams change.