1 # Node.js Collaborator Guide
5 * [Issues and Pull Requests](#issues-and-pull-requests)
6 * [Accepting Modifications](#accepting-modifications)
7 - [Involving the TC](#involving-the-tc)
8 * [Landing Pull Requests](#landing-pull-requests)
9 - [Technical HOWTO](#technical-howto)
10 - [I Just Made a Mistake](#i-just-made-a-mistake)
11 - [Long Term Support](#long-term-support)
13 This document contains information for Collaborators of the Node.js
14 project regarding maintaining the code, documentation and issues.
16 Collaborators should be familiar with the guidelines for new
17 contributors in [CONTRIBUTING.md](./CONTRIBUTING.md) and also
18 understand the project governance model as outlined in
19 [GOVERNANCE.md](./GOVERNANCE.md).
21 ## Issues and Pull Requests
23 Courtesy should always be shown to individuals submitting issues and
24 pull requests to the Node.js project.
26 Collaborators should feel free to take full responsibility for
27 managing issues and pull requests they feel qualified to handle, as
28 long as this is done while being mindful of these guidelines, the
29 opinions of other Collaborators and guidance of the TC.
31 Collaborators may **close** any issue or pull request they believe is
32 not relevant for the future of the Node.js project. Where this is
33 unclear, the issue should be left open for several days to allow for
34 additional discussion. Where this does not yield input from Node.js
35 Collaborators or additional evidence that the issue has relevance, the
36 issue may be closed. Remember that issues can always be re-opened if
39 ## Accepting Modifications
41 All modifications to the Node.js code and documentation should be
42 performed via GitHub pull requests, including modifications by
43 Collaborators and TC members.
45 All pull requests must be reviewed and accepted by a Collaborator with
46 sufficient expertise who is able to take full responsibility for the
47 change. In the case of pull requests proposed by an existing
48 Collaborator, an additional Collaborator is required for sign-off.
50 In some cases, it may be necessary to summon a qualified Collaborator
51 to a pull request for review by @-mention.
53 If you are unsure about the modification and are not prepared to take
54 full responsibility for the change, defer to another Collaborator.
56 Before landing pull requests, sufficient time should be left for input
57 from other Collaborators. Leave at least 48 hours during the week and
58 72 hours over weekends to account for international time differences
59 and work schedules. Trivial changes (e.g. those which fix minor bugs
60 or improve performance without affecting API or causing other
61 wide-reaching impact) may be landed after a shorter delay.
63 Where there is no disagreement amongst Collaborators, a pull request
64 may be landed given appropriate review. Where there is discussion
65 amongst Collaborators, consensus should be sought if possible. The
66 lack of consensus may indicate the need to elevate discussion to the
67 TC for resolution (see below).
69 All bugfixes require a test case which demonstrates the defect. The
70 test should *fail* before the change, and *pass* after the change.
72 All pull requests that modify executable code should be subjected to
73 continuous integration tests on the
74 [project CI server](https://ci.nodejs.org/).
78 Collaborators may opt to elevate pull requests or issues to the TC for
79 discussion by assigning the ***tc-agenda*** tag. This should be done
82 - has a significant impact on the codebase,
83 - is inherently controversial; or
84 - has failed to reach consensus amongst the Collaborators who are
85 actively participating in the discussion.
87 The TC should serve as the final arbiter where required.
89 ## Landing Pull Requests
91 Always modify the original commit message to include additional meta
92 information regarding the change process:
94 - A `Reviewed-By: Name <email>` line for yourself and any
95 other Collaborators who have reviewed the change.
96 - A `PR-URL:` line that references the full GitHub URL of the original
97 pull request being merged so it's easy to trace a commit back to the
98 conversation that led up to that change.
99 - A `Fixes: X` line, where _X_ is either includes the full GitHub URL
100 for an issue, and/or the hash and commit message if the commit fixes
101 a bug in a previous commit. Multiple `Fixes:` lines may be added if
104 See the commit log for examples such as
105 [this one](https://github.com/nodejs/node/commit/b636ba8186) if unsure
106 exactly how to format your commit messages.
110 - Double check PRs to make sure the person's _full name_ and email
111 address are correct before merging.
112 - Except when updating dependencies, all commits should be self
113 contained (meaning every commit should pass all tests). This makes
114 it much easier when bisecting to find a breaking change.
118 _Optional:_ ensure that you are not in a borked `am`/`rebase` state
125 Checkout proper target branch
128 $ git checkout master
135 $ git merge --ff-only origin/master
138 Apply external patches
141 $ curl -L https://github.com/nodejs/node/pull/xxx.patch | git am --whitespace=fix
144 Check and re-review the changes
147 $ git diff origin/master
150 Check number of commits and commit messages
153 $ git log origin/master...master
156 If there are multiple commits that relate to the same feature or
157 one with a feature and separate with a test for that feature,
158 you'll need to use `squash` or `fixup`:
161 $ git rebase -i origin/master
164 This will open a screen like this (in the default shell editor):
167 pick 6928fc1 crypto: add feature A
168 pick 8120c4c add test for feature A
169 pick 51759dc feature B
170 pick 7d6f433 test for feature B
172 # Rebase f9456a2..7d6f433 onto f9456a2
175 # p, pick = use commit
176 # r, reword = use commit, but edit the commit message
177 # e, edit = use commit, but stop for amending
178 # s, squash = use commit, but meld into previous commit
179 # f, fixup = like "squash", but discard this commit's log message
180 # x, exec = run command (the rest of the line) using shell
182 # These lines can be re-ordered; they are executed from top to bottom.
184 # If you remove a line here THAT COMMIT WILL BE LOST.
186 # However, if you remove everything, the rebase will be aborted.
188 # Note that empty commits are commented out
191 Replace a couple of `pick`s with `fixup` to squash them into a
195 pick 6928fc1 crypto: add feature A
196 fixup 8120c4c add test for feature A
197 pick 51759dc feature B
198 fixup 7d6f433 test for feature B
201 Replace `pick` with `reword` to change the commit message:
204 reword 6928fc1 crypto: add feature A
205 fixup 8120c4c add test for feature A
206 reword 51759dc feature B
207 fixup 7d6f433 test for feature B
210 Save the file and close the editor. You'll be asked to enter a new
211 commit message for that commit. This is a good moment to fix incorrect
212 commit logs, ensure that they are properly formatted, and add
218 $ git push origin master
221 ### I Just Made a Mistake
223 With `git`, there's a way to override remote trees by force pushing
224 (`git push -f`). This should generally be seen as forbidden (since
225 you're rewriting history on a repository other people are working
226 against) but is allowed for simpler slip-ups such as typos in commit
227 messages. However, you are only allowed to force push to any Node.js
228 branch within 10 minutes from your original push. If someone else
229 pushes to the branch or the 10 minute period passes, consider the
232 ### Long Term Support
236 Long Term Support (often referred to as *LTS*) guarantees application developers
237 a 30 month support cycle with specific versions of Node.js.
239 You can find more information [in the full LTS plan](https://github.com/nodejs/lts#lts-plan).
241 #### How does LTS work?
243 Once a stable branch enters LTS, no new features may be added to that release. Changes are
244 limited to bug fixes, security updates, possible npm updates, documentation updates, and certain
245 performance improvements that can be demonstrated to not break existing applications.
246 Semver-minor changes are only permitted if required for bug fixes. Semver-major changes are only
247 permitted if required for critical security and bug fixes.
249 Once a stable branch moves into Maintenance mode, only **critical** bugs, **critical** security fixes,
250 and documentation updates will be permitted.
254 When you send your pull request, consider including information about
255 whether your change is breaking. If you think your patch can be backported,
256 please feel free to include that information in the PR thread.
258 #### Who is doing the backporting?
260 The current plan is for commits to cherry pick into a staging branch (e.g. v4.x-staging),
261 which can be done by anyone. The preference would be for the individual landing the commit
262 on master to backport to staging branches if it is appropriate.
264 #### How is an LTS release cut?
266 When the LTS working group determines that a new LTS release is required, selected commits
267 will be picked from the staging branch to be included in the release. This process of making
268 a release will be a collaboration between the LTS working group and the Release team.