Registry / devops / github-cherry-pick

github-cherry-pick

JSON →
library1.1.0jsnpmunverified

A library for cherry-picking multiple commits onto a branch using GitHub's low-level Git Data API (v3). Version 1.1.0 is the latest and only stable release. It operates without requiring a local Git installation, making it suitable for serverless or browser environments. Differentiates from git-based tools by relying solely on REST API calls via @octokit/rest. Requires Node.js >= 6.11.2 and is ESM-only. Maintained as part of the github-backport and github-rebase ecosystem.

devops
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Package is ESM-only, CommonJS require will fail. Use dynamic import() if needed in CJS context.

import { cherryPickCommits } from 'github-cherry-pick'

There is no default export; named export is the only way.

import { cherryPickCommits } from 'github-cherry-pick'

Options type is exported for TypeScript users, but should be used with 'import type' to avoid runtime overhead.

import type { CherryPickCommitsOptions } from 'github-cherry-pick'

Cherry-picks two commits onto a branch using GitHub REST API with an Octokit instance.

import { cherryPickCommits } from 'github-cherry-pick'; import { Octokit } from '@octokit/rest'; const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN ?? '' }); const newHeadSha = await cherryPickCommits({ commits: [ '8b10a7808f06970232dc1b45a77b47d63641c4f1', 'f393441512c54435819d1cdd8921c0d566911af3', ], head: 'awesome-feature', octokit, owner: 'my-org', repo: 'my-repo', }); console.log('New head SHA:', newHeadSha);
Debug
Known footguns
breakingPackage is ESM-only. require() will throw.
gotchaMerge commits are not supported and will cause errors.
gotchaThe 'octokit' parameter must be an already-authenticated instance of @octokit/rest (not @octokit/core).
deprecatedDebug logging uses the 'debug' package; requires setting DEBUG=github-cherry-pick environment variable.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
7 hits · last 30 days
gptbot
3
Resources