Skip to content

Commit 7ecaffc

Browse files
kirjsmmalerba
authored andcommitted
docs: move commit message guidelies to a separate file (angular#58786)
PR Close angular#58786
1 parent bec6e56 commit 7ecaffc

File tree

4 files changed

+169
-157
lines changed

4 files changed

+169
-157
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## PR Checklist
22
Please check if your PR fulfills the following requirements:
33

4-
- [ ] The commit message follows our guidelines: https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit
4+
- [ ] The commit message follows our guidelines: https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md
55
- [ ] Tests for the changes have been added (for bug fixes / features)
66
- [ ] Docs have been added / updated (for bug fixes / features)
77

.gitmessage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Fixes #<issue number>
7474
# =============================
7575
#
7676
# The full specification of the Angular Commit Message Format can be found at
77-
# https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit
77+
# https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md
7878
#
7979
# The following is an excerpt of the specification with the most commonly needed info.
8080
#

CONTRIBUTING.md

Lines changed: 6 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Before you submit your Pull Request (PR) consider the following guidelines:
103103

104104
8. Run the full Angular test suite, as described in the [developer documentation][dev-doc], and ensure that all tests pass.
105105

106-
9. Commit your changes using a descriptive commit message that follows our [commit message conventions](#commit).
106+
9. Commit your changes using a descriptive commit message that follows our [commit message conventions][commit-message-guidelines].
107107
Adherence to these conventions is necessary because release notes are automatically generated from these messages.
108108

109109
```shell
@@ -145,7 +145,7 @@ That's it! Thank you for your contribution!
145145

146146
##### Updating the commit message
147147

148-
A reviewer might often suggest changes to a commit message (for example, to add more context for a change or adhere to our [commit message guidelines](#commit)).
148+
A reviewer might often suggest changes to a commit message (for example, to add more context for a change or adhere to our [commit message guidelines][commit-message-guidelines]).
149149
In order to update the commit message of the last commit on your branch:
150150

151151
1. Check out your branch:
@@ -210,163 +210,14 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
210210
An automated formatter is available, see [DEVELOPER.md](contributing-docs/building-and-testing-angular.md#formatting-your-source-code).
211211
212212
213-
## <a name="commit"></a> Commit Message Format
214-
215-
*This specification is inspired by and supersedes the [AngularJS commit message format][commit-message-format].*
216-
217-
We have very precise rules over how our Git commit messages must be formatted.
218-
This format leads to **easier to read commit history**.
219-
220-
Each commit message consists of a **header**, a **body**, and a **footer**.
221-
222-
223-
```
224-
<header>
225-
<BLANK LINE>
226-
<body>
227-
<BLANK LINE>
228-
<footer>
229-
```
230-
231-
The `header` is mandatory and must conform to the [Commit Message Header](#commit-header) format.
232-
233-
The `body` is mandatory for all commits except for those of type "docs".
234-
When the body is present it must be at least 20 characters long and must conform to the [Commit Message Body](#commit-body) format.
235-
236-
The `footer` is optional. The [Commit Message Footer](#commit-footer) format describes what the footer is used for and the structure it must have.
237-
238-
239-
#### <a name="commit-header"></a>Commit Message Header
213+
## <a name="commit"></a> Commit Message Guidelines
240214
215+
We have very precise rules over how our Git commit messages must be formatted:
241216
```
242217
<type>(<scope>): <short summary>
243-
│ │ │
244-
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
245-
│ │
246-
│ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
247-
│ elements|forms|http|language-service|localize|platform-browser|
248-
│ platform-browser-dynamic|platform-server|router|service-worker|
249-
│ upgrade|zone.js|packaging|changelog|docs-infra|migrations|
250-
│ devtools
251-
252-
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
253-
```
254-
255-
The `<type>` and `<summary>` fields are mandatory, the `(<scope>)` field is optional.
256-
257-
258-
##### Type
259-
260-
Must be one of the following:
261-
262-
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
263-
* **ci**: Changes to our CI configuration files and scripts (examples: Github Actions, SauceLabs)
264-
* **docs**: Documentation only changes
265-
* **feat**: A new feature
266-
* **fix**: A bug fix
267-
* **perf**: A code change that improves performance
268-
* **refactor**: A code change that neither fixes a bug nor adds a feature
269-
* **test**: Adding missing tests or correcting existing tests
270-
271-
272-
##### Scope
273-
The scope should be the name of the npm package affected (as perceived by the person reading the changelog generated from commit messages).
274-
275-
The following is the list of supported scopes:
276-
277-
* `animations`
278-
* `bazel`
279-
* `benchpress`
280-
* `common`
281-
* `compiler`
282-
* `compiler-cli`
283-
* `core`
284-
* `elements`
285-
* `forms`
286-
* `http`
287-
* `language-service`
288-
* `localize`
289-
* `platform-browser`
290-
* `platform-browser-dynamic`
291-
* `platform-server`
292-
* `router`
293-
* `service-worker`
294-
* `upgrade`
295-
* `zone.js`
296-
297-
There are currently a few exceptions to the "use package name" rule:
298-
299-
* `packaging`: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
300-
301-
* `changelog`: used for updating the release notes in CHANGELOG.md
302-
303-
* `dev-infra`: used for dev-infra related changes within the directories /scripts and /tools
304-
305-
* `docs-infra`: used for docs-app (angular.dev) related changes within the /adev directory of the repo
306-
307-
* `migrations`: used for changes to the `ng update` migrations.
308-
309-
* `devtools`: used for changes in the [browser extension](./devtools/README.md).
310-
311-
* none/empty string: useful for `test` and `refactor` changes that are done across all packages (e.g. `test: add missing unit tests`) and for docs changes that are not related to a specific package (e.g. `docs: fix typo in tutorial`).
312-
313-
314-
##### Summary
315-
316-
Use the summary field to provide a succinct description of the change:
317-
318-
* use the imperative, present tense: "change" not "changed" nor "changes"
319-
* don't capitalize the first letter
320-
* no dot (.) at the end
321-
322-
323-
#### <a name="commit-body"></a>Commit Message Body
324-
325-
Just as in the summary, use the imperative, present tense: "fix" not "fixed" nor "fixes".
326-
327-
Explain the motivation for the change in the commit message body. This commit message should explain _why_ you are making the change.
328-
You can include a comparison of the previous behavior with the new behavior in order to illustrate the impact of the change.
329-
330-
331-
#### <a name="commit-footer"></a>Commit Message Footer
332-
333-
The footer can contain information about breaking changes and deprecations and is also the place to reference GitHub issues, Jira tickets, and other PRs that this commit closes or is related to.
334-
For example:
335-
336-
```
337-
BREAKING CHANGE: <breaking change summary>
338-
<BLANK LINE>
339-
<breaking change description + migration instructions>
340-
<BLANK LINE>
341-
<BLANK LINE>
342-
Fixes #<issue number>
343218
```
344219
345-
or
346-
347-
```
348-
DEPRECATED: <what is deprecated>
349-
<BLANK LINE>
350-
<deprecation description + recommended update path>
351-
<BLANK LINE>
352-
<BLANK LINE>
353-
Closes #<pr number>
354-
```
355-
356-
Breaking Change section should start with the phrase `BREAKING CHANGE: ` followed by a summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.
357-
358-
Similarly, a Deprecation section should start with `DEPRECATED: ` followed by a short description of what is deprecated, a blank line, and a detailed description of the deprecation that also mentions the recommended update path.
359-
360-
361-
### Revert commits
362-
363-
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
364-
365-
The content of the commit message body should contain:
366-
367-
- information about the SHA of the commit being reverted in the following format: `This reverts commit <SHA>`,
368-
- a clear description of the reason for reverting the commit message.
369-
220+
See [Commit Message Guidelines][commit-message-guidelines].
370221
371222
## <a name="cla"></a> Signing the CLA
372223
@@ -390,9 +241,9 @@ The following documents can help you sort out issues with GitHub accounts and mu
390241
391242
392243
[coc]: https://github.com/angular/code-of-conduct/blob/main/CODE_OF_CONDUCT.md
393-
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
394244
[corporate-cla]: https://cla.developers.google.com/about/google-corporate
395245
[dev-doc]: ./contributing-docs/building-and-testing-angular.md
246+
[commit-message-guidelines]: ./contributing-docs/building-and-testing-angular.md
396247
[github]: https://github.com/angular/angular
397248
[discord]: https://discord.gg/angular
398249
[individual-cla]: https://cla.developers.google.com/about/google-individual
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# Commit Message Format
2+
3+
*This specification is inspired by and supersedes the [AngularJS commit message format][angularjs-commit-message-format].*
4+
5+
We have very precise rules over how our Git commit messages must be formatted.
6+
This format leads to **easier to read commit history**.
7+
8+
Each commit message consists of a **header**, a **body**, and a **footer**.
9+
10+
11+
```
12+
<header>
13+
<BLANK LINE>
14+
<body>
15+
<BLANK LINE>
16+
<footer>
17+
```
18+
19+
The `header` is mandatory and must conform to the [Commit Message Header](#commit-header) format.
20+
21+
The `body` is mandatory for all commits except for those of type "docs".
22+
When the body is present it must be at least 20 characters long and must conform to the [Commit Message Body](#commit-body) format.
23+
24+
The `footer` is optional. The [Commit Message Footer](#commit-footer) format describes what the footer is used for and the structure it must have.
25+
26+
27+
## <a name="commit-header"></a>Commit Message Header
28+
29+
```
30+
<type>(<scope>): <short summary>
31+
│ │ │
32+
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
33+
│ │
34+
│ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
35+
│ elements|forms|http|language-service|localize|platform-browser|
36+
│ platform-browser-dynamic|platform-server|router|service-worker|
37+
│ upgrade|zone.js|packaging|changelog|docs-infra|migrations|
38+
│ devtools
39+
40+
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
41+
```
42+
43+
The `<type>` and `<summary>` fields are mandatory, the `(<scope>)` field is optional.
44+
45+
46+
### Type
47+
48+
Must be one of the following:
49+
50+
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
51+
* **ci**: Changes to our CI configuration files and scripts (examples: Github Actions, SauceLabs)
52+
* **docs**: Documentation only changes
53+
* **feat**: A new feature
54+
* **fix**: A bug fix
55+
* **perf**: A code change that improves performance
56+
* **refactor**: A code change that neither fixes a bug nor adds a feature
57+
* **test**: Adding missing tests or correcting existing tests
58+
59+
60+
### Scope
61+
The scope should be the name of the npm package affected (as perceived by the person reading the changelog generated from commit messages).
62+
63+
The following is the list of supported scopes:
64+
65+
* `animations`
66+
* `bazel`
67+
* `benchpress`
68+
* `common`
69+
* `compiler`
70+
* `compiler-cli`
71+
* `core`
72+
* `elements`
73+
* `forms`
74+
* `http`
75+
* `language-service`
76+
* `localize`
77+
* `platform-browser`
78+
* `platform-browser-dynamic`
79+
* `platform-server`
80+
* `router`
81+
* `service-worker`
82+
* `upgrade`
83+
* `zone.js`
84+
85+
There are currently a few exceptions to the "use package name" rule:
86+
87+
* `packaging`: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
88+
89+
* `changelog`: used for updating the release notes in CHANGELOG.md
90+
91+
* `dev-infra`: used for dev-infra related changes within the directories /scripts and /tools
92+
93+
* `docs-infra`: used for docs-app (angular.dev) related changes within the /adev directory of the repo
94+
95+
* `migrations`: used for changes to the `ng update` migrations.
96+
97+
* `devtools`: used for changes in the [browser extension](../devtools/README.md).
98+
99+
* none/empty string: useful for `test` and `refactor` changes that are done across all packages (e.g. `test: add missing unit tests`) and for docs changes that are not related to a specific package (e.g. `docs: fix typo in tutorial`).
100+
101+
102+
### Summary
103+
104+
Use the summary field to provide a succinct description of the change:
105+
106+
* use the imperative, present tense: "change" not "changed" nor "changes"
107+
* don't capitalize the first letter
108+
* no dot (.) at the end
109+
110+
111+
## <a name="commit-body"></a>Commit Message Body
112+
113+
Just as in the summary, use the imperative, present tense: "fix" not "fixed" nor "fixes".
114+
115+
Explain the motivation for the change in the commit message body. This commit message should explain _why_ you are making the change.
116+
You can include a comparison of the previous behavior with the new behavior in order to illustrate the impact of the change.
117+
118+
119+
## <a name="commit-footer"></a>Commit Message Footer
120+
121+
The footer can contain information about breaking changes and deprecations and is also the place to reference GitHub issues, Jira tickets, and other PRs that this commit closes or is related to.
122+
For example:
123+
124+
```
125+
BREAKING CHANGE: <breaking change summary>
126+
<BLANK LINE>
127+
<breaking change description + migration instructions>
128+
<BLANK LINE>
129+
<BLANK LINE>
130+
Fixes #<issue number>
131+
```
132+
133+
or
134+
135+
```
136+
DEPRECATED: <what is deprecated>
137+
<BLANK LINE>
138+
<deprecation description + recommended update path>
139+
<BLANK LINE>
140+
<BLANK LINE>
141+
Closes #<pr number>
142+
```
143+
144+
Breaking Change section should start with the phrase `BREAKING CHANGE: ` followed by a summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.
145+
146+
Similarly, a Deprecation section should start with `DEPRECATED: ` followed by a short description of what is deprecated, a blank line, and a detailed description of the deprecation that also mentions the recommended update path.
147+
148+
149+
## Revert commits
150+
151+
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
152+
153+
The content of the commit message body should contain:
154+
155+
- information about the SHA of the commit being reverted in the following format: `This reverts commit <SHA>`,
156+
- a clear description of the reason for reverting the commit message.
157+
158+
159+
160+
161+
[angularjs-commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#

0 commit comments

Comments
 (0)