What is a CODEOWNERS file in GitHub?
CODEOWNERS maps file paths to people or teams. GitHub automatically requests their review on pull requests touching those paths, and with branch protection their approval can be mandatory.
Explain it simply
In a college fest committee, the finance head must approve any spending, and the design head approves posters. CODEOWNERS writes down who approves what.
The file lives at .github/CODEOWNERS (or the repo root or docs/). Each line is a pattern and one or more owners. When a PR changes matching files, the owners are added as reviewers. Turn on 'Require review from Code Owners' in branch protection to make their approval compulsory. The last matching pattern wins.
Example
# .github/CODEOWNERS
*.md @docs-team
/payments/ @asha @payments-team
/.github/ @admin-teamWhat to say in the interview
"CODEOWNERS assigns files and folders to owners, who are automatically requested for review on matching PRs. With branch protection I can require their approval, so critical code is always checked by the right people."