Free Tool

CODEOWNERS Generator

Create GitHub CODEOWNERS files with ease. Define ownership rules for directories, files, and patterns.

Ownership Rules

Use * for all files, *.ext for extensions, /path/ for directories

Separate multiple owners with spaces or commas

Preview

# CODEOWNERS file
# This file defines code ownership for this repository.
# Each line is a file pattern followed by one or more owners.
#
# Owners can be:
#   - GitHub usernames: @username
#   - GitHub teams: @org/team-name
#   - Email addresses: user@example.com
#
# Patterns use gitignore-style matching:
#   *           - matches everything
#   *.js        - matches all JavaScript files
#   /docs/      - matches the docs directory at root
#   docs/       - matches any docs directory
#   **/*.go     - matches all Go files in any directory

*  @default-team

How to Use CODEOWNERS

1. Create the File

Add a file named CODEOWNERS to one of these locations:

  • Repository root: /CODEOWNERS
  • Docs folder: /docs/CODEOWNERS
  • GitHub folder: /.github/CODEOWNERS

2. Pattern Syntax

  • * - Matches all files (default owner)
  • *.js - All JavaScript files
  • /docs/ - Docs directory at repository root
  • docs/ - Any docs directory
  • **/*.go - All Go files in any directory
  • src/api/** - Everything under src/api/

3. Owner Format

  • @username - GitHub user
  • @org/team-name - GitHub team
  • user@example.com - Email address
  • Multiple owners: @user1 @user2 @org/team

4. How It Works

When a pull request is opened:

  • GitHub matches changed files against patterns (last match wins)
  • Automatically requests reviews from matched owners
  • Requires approval from code owners before merging (if enabled)
  • Works with branch protection rules

Pro Tip: Use Octiew to automatically route PRs to the right reviewers based on your CODEOWNERS file, with intelligent accept/decline workflows that prevent PRs from going stale!