You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners.md
+29Lines changed: 29 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -84,13 +84,42 @@ apps/ @octocat
84
84
# directory in the root of your repository and any of its
85
85
# subdirectories.
86
86
/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
87
93
```
88
94
### Syntax exceptions
89
95
There are some syntax rules for gitignore files that do not work in CODEOWNERS files:
90
96
- Escaping a pattern starting with `#` using `\` so it is treated as a pattern and not a comment
91
97
- Using `!` to negate a pattern
92
98
- Using `[ ]` to define a character range
93
99
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.
0 commit comments