Overview
Backporting allows important changes to be applied to previous Node.js release lines. This guide covers when and how to backport changes.Staging Branches
Each release line has a staging branch for preparing releases:N is the major release number (e.g., v20.x-staging, v22.x-staging).
For currently active staging branches, refer to the Release Schedule.
When Backporting is Needed
If a cherry-pick frommain doesn’t apply cleanly to a staging branch, the pull request will be labeled with backport-requested-vN.x, indicating manual backporting is required.
Backporting Criteria
Current Release Line
The “Current” release line has more flexibility for backporting changes.LTS Release Lines
Long-Term Support (LTS) branches have stricter requirements:- Commits must mature in the Current release for at least two weeks before backporting
- Changes should be stable and well-tested
- Follow the Release Plan guidelines
Backport Labels
Use these labels during the backport process (whereN is the major version number):
| Label | Description |
|---|---|
backport-blocked-vN.x | PRs blocked by pending backports from other PRs |
backport-open-vN.x | Indicates an open backport PR exists |
backport-requested-vN.x | PR awaiting manual backport to vN.x-staging |
backported-to-vN.x | PR successfully backported to vN.x-staging |
baking-for-lts | PRs awaiting LTS release after maturation in Current |
lts-watch-vN.x | PRs possibly included in vN.x LTS releases |
vN.x | Issues or PRs impacting vN.x-staging |
Automated Backport Process
The automated process using Node.js core utilities is the recommended approach.Prerequisites
Install the Node.js core utilities:Steps
Manual Backport Process
Use this process when the automated method isn’t available or encounters issues.Step 1: Checkout Staging Branch
Step 2: Cherry-Pick Commits
Step 3: Resolve Conflicts
If conflicts occur:Step 4: Preserve Commit Message
Leave the commit message as is. Don’t addBackport-PR-URL metadata yet - this will be done later.
If you think the commit message should be modified, comment in the pull request rather than changing it directly.
Step 5: Run Tests
Verify the backport works correctly:Step 6: Push to Your Fork
Step 7: Open Pull Request
Create a PR with: Target:vN.x-staging
Title Format:
Step 8: Update Labels
On the original pull request:- Remove:
backport-requested-vN.x - Add:
backport-open-vN.x
Step 9: Handle Rebase if Needed
If conflicts arise during review:Step 10: After Merge
Once the backport PR is merged, update the original PR:- Remove:
backport-open-vN.x - Add:
backported-to-vN.x
Common Scenarios
Backporting to Multiple Release Lines
If a change needs to be backported to multiple versions:Blocked Backports
If your backport depends on another PR that hasn’t been backported yet:- Add
backport-blocked-vN.xlabel to your PR - Reference the blocking PR in a comment
- Wait for the blocking PR to be backported first
- Proceed with your backport after the dependency is resolved
Cherry-Picking Multiple Commits
For PRs with multiple commits:Best Practices
Test Thoroughly
Verify Compatibility
Ensure the backported change:- Doesn’t introduce breaking changes
- Works with the older codebase
- Maintains API compatibility
Document Changes
If the backport required modifications:- Document changes in the PR description
- Explain why modifications were necessary
- Note any differences from the original commit
Communication
- Keep the original PR author informed
- Tag relevant team members for review
- Mention any challenges encountered during backporting
Troubleshooting
Cherry-Pick Conflicts
Failed Tests
If tests fail after backporting:- Review test failures carefully
- Check if dependencies changed between versions
- Adapt the backport as needed
- Document any required modifications
Multiple Conflict Resolutions
For complex backports with many conflicts:Release Process Integration
Backported changes follow this workflow:- Merged to staging: Change is in
vN.x-staging - Release preparation: Staging branch is tested
- Release: Change is included in the next
vN.xrelease - Publication: Release is published to nodejs.org
Related Resources
Release Schedule
View active release lines
Release Plan
Understand release policies
Core Utils
Install backport automation tools
Git Node Backport
Backport command documentation