Skip to content

Merging Guidelines

Audrey Eschright edited this page Dec 11, 2018 · 1 revision

Merging pull requests

Most pull requests should target release-next (excepting situations where we are patching a prior release). If something else is intended, make sure that's noted in the PR. The release manager will need to retarget the PR if it is not set correctly.

Checkout the pull request you want to merge:

git checkout -b pr/##### upstream/pr/#####

Rebase it on to the target branch. We do this interactively to let you visually ensure that only the correct commits are included. It also gives you an opportunity to squash commits or reword commit messages. The latter is common to give more context to future code-archeologists.

git rebase --interactive <release-next|latest|etc>

Make sure each commit has a PR-URL line in its commit body pointing to this PR:

PR-URL: https://github.com/npm/REPO/pull/<prnum>

Further, if the commit is resolving an issue, make sure it has:

Fixes: #<issue-url>

Also add the contributor and reviewer credits:

Credit: @<username>
Reviewed-By: @<username>

Once that looks good we rebase again to clean up any whitespace errors that got committed:

git rebase --whitespace=fix <release-next|latest|etc>

Verify that tests pass with the change:

npm test

If they don't pass, either fix the problem or pass it back to the committer.

If everything looks good:

git checkout <release-next|latest|etc>
git merge --ff-only pr/#####
git push

Once you're done, comment on the pull request if it wasn't automatically closed with the SHA1 of the pushed commit, and if all target branches have been merged to, close it.

Clone this wiki locally