Skip to content

Commit 01816d2

Browse files
committed
[#1421] Update git commit guide
Modify the git commit guide to be clearer, specifically asking to link GitHub issues with every commit. Also update the pull request template with the line "Fixes #issue-number" so that every PR will close an issue when it is merged.
1 parent 33b290d commit 01816d2

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Fixes #issue-number
2+
13
I have verified that this pull request:
24

35
* [ ] has no linting errors (`npm run lint`)

developer_docs/development.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ A guide for adding code to this project.
66
- [Installation](#installation)
77
- [Development Workflow](#development-workflow)
88
- [Tests](#tests)
9-
- [Writing Git Commit Messages](#writing-git-commit-messages)
10-
- [Tips](#tips)
9+
- [Committing Code](#committing-code)
10+
- [General Rules](#general-rules)
11+
- [Commit Messages](#commit-messages)
1112
- [Design](#design)
1213
- [Technologies Used](#technologies-used)
1314

@@ -31,41 +32,45 @@ To run the test suite simply run `npm test` (after installing dependencies with
3132

3233
A sample unit test could be found here: [Nav.test.jsx](../client/components/__test__/Nav.test.jsx).
3334

34-
## Writing Git Commit Messages
35+
## Committing Code
36+
Inspired by [Git/GitHub commit standards & conventions](https://gist.github.com/digitaljhelms/3761873).
3537

3638
Good commit messages serve at least three important purposes:
3739

3840
* They speed up the reviewing process.
3941
* They help us write good release notes.
4042
* They help future maintainers understand your change and the reasons behind it.
4143

44+
45+
### General Rules
46+
* Make [atomic commits](http://en.wikipedia.org/wiki/Atomic_commit) of changes, even across multiple files, in logical units. That is, as much as possible, each commit should be focused on one specific purpose.
47+
* As much as possible, make sure a commit does not contain unnecessary whitespace changes. This can be checked as follows:
48+
49+
```
50+
$ git diff --check
51+
```
52+
53+
### Commit Messages
54+
4255
Structure your commit message like this:
4356

4457
```
45-
Short (50 chars or less) summary of changes ( involving Fixes #Issue-number keyword )
58+
[#issueid] Short (50 chars or less) summary of changes
4659
47-
More detailed explanatory text, if necessary. Wrap it to about 72
48-
characters or so. In some contexts, the first line is treated as the
49-
subject of an email and the rest of the text as the body. The blank
50-
line separating the summary from the body is critical (unless you omit
51-
the body entirely); tools like rebase can get confused if you run the
52-
two together.
60+
More detailed explanatory text, if necessary. Wrap it to about 72 characters or so. In some contexts, the first line is treated as the subject of an email and the rest of the text as the body. The blank line separating the summary from the body is critical (unless you omit the body entirely); tools like rebase can get confused if you run the two together.
5361
5462
Further paragraphs come after blank lines.
5563
5664
- Bullet points are okay, too
5765
58-
- Typically a hyphen or asterisk is used for the bullet, preceded by a
59-
single space, with blank lines in between, but conventions vary here
66+
- Typically a hyphen or asterisk is used for the bullet, preceded by a single space, with blank lines in between, but conventions vary here
6067
```
61-
6268
* Write the summary line and description of what you have done in the imperative mode, that is as if you were commanding someone. Start the line with "Fix", "Add", "Change" instead of "Fixed", "Added", "Changed".
69+
* Link the GitHub issue you are working on in the summary line in brackets, e.g. [#123]
6370
* Always leave the second line blank.
6471
* Be as descriptive as possible in the description. It helps reasoning about the intention of commits and gives more context about why changes happened.
65-
66-
### Tips
67-
6872
* If it seems difficult to summarize what your commit does, it may be because it includes several logical changes or bug fixes, and are better split up into several commits using `git add -p`.
73+
* Note that you can connect multiple issues to a commit, if necessary: `[#123][#456] Add Button component`
6974

7075
## Design
7176
- [Style Guide/Design System on Figma](https://github.com/processing/p5.js-web-editor/labels/good%20medium%20issues)

0 commit comments

Comments
 (0)