# GitHub CODEOWNERS Directory Pattern Match Cheatsheet

> A cheatsheet for GitHub CODEOWNERS pattern for matching a directory and all of its contents

Source: https://curiouslychase.com/engineering/github-codeowners-directory-pattern-match-cheatsheet/

A cheatsheet for the pattern to use to match certain [paths for a GitHub CODEOWNERS file](https://help.github.com/en/articles/about-code-owners).

The cheatsheet uses `/.buildkite` as an example. `` in the "I want to match" section is the `git` root of your project.

| I want to match...                             | Pattern              |
| :--------------------------------------------- | :------------------- |
| all files in `/.buildkite`               | `.buildkite/**`      |
| `.buildkite` directory anywhere in the project | `**/.buildkite`      |
| everything _but_ `/.buildkite`           | `!.buildkite`        |
| `.buildkite` anywhere in `test`                | `test/**/.buildkite` |
