Skip to content

Commit 98dea8b

Browse files
authored
Merge branch 'main' into repo-sync
2 parents ee0a494 + 3dac8c2 commit 98dea8b

File tree

1 file changed

+29
-0
lines changed
  • content/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github

1 file changed

+29
-0
lines changed

content/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,42 @@ apps/ @octocat
8484
# directory in the root of your repository and any of its
8585
# subdirectories.
8686
/docs/ @doctocat
87+
88+
# In this example, @octocat owns any file in the `/apps`
89+
# directory in the root of your repository except for the `/apps/github`
90+
# subdirectory, as its owners are left empty.
91+
/apps/ @octocat
92+
/apps/github
8793
```
8894
### Syntax exceptions
8995
There are some syntax rules for gitignore files that do not work in CODEOWNERS files:
9096
- Escaping a pattern starting with `#` using `\` so it is treated as a pattern and not a comment
9197
- Using `!` to negate a pattern
9298
- Using `[ ]` to define a character range
9399

100+
## CODEOWNERS and branch protection
101+
Repository owners can add branch protection rules to ensure that changed code is reviewed by the owners of the changed files. For more information, see "[About protected branches](/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)."
102+
103+
104+
### Example of a CODEOWNERS file
105+
```
106+
# In this example, any change inside the `/apps` directory
107+
# will require approval from @doctocat.
108+
/apps/ @doctocat
109+
110+
# In this example, any change inside the `/apps` directory
111+
# will require approval from @doctocat or @octocat.
112+
/apps/ @doctocat @octocat
113+
114+
# In this example, any change inside the `/apps` directory
115+
# will require approval from a member of the @example-org/content team.
116+
# If a member of @example-org/content opens a pull request
117+
# with a change inside the `/apps` directory, their approval is implicit.
118+
# The team is still added as a reviewer but not a required reviewer.
119+
# Anyone can approve the changes.
120+
/apps/ @example-org/content-team
121+
```
122+
94123

95124

96125
## Further reading

0 commit comments

Comments
 (0)