← 全部工具

backport

热度 65 更新于 开发与构建

A CLI tool that automates the process of backporting commits

npmauto-collected

安装

npm
npm install -g backport

通过 npm 安装。

<div align="center" <img src="https://user-images.githubusercontent.com/209966/148229483-9f867a20-da7d-4cff-8c52-fcb27d482b89.png" height="200" <p <bA CLI tool that automates the process of backporting commits.</b </p <p <a href="https://www.npmjs.com/package/backport"<img src="https://img.shields.io/npm/v/backport.svg" alt="npm version"</a </p <br </div

🎉 New: The Backport Tool as a Github Action 🎉

A Github Action around The Backport Tool now exists. It makes it a breeze to get automatic backports when pull requests are merged.

Backport CLI tool

The remaining documentation focuses on the Backport CLI tool (not the Github Action) although all configuration options apply to the Github Action too. The only difference is that the CLI tool is interactive and run manually locally, where the Github Action runs automatically.

How it works

  • Select a commit to backport
  • Select a branch to backport to
  • The commit will be cherrypicked, pushed and a pull request created.

Requirements

  • Node 22 or higher
  • git

Install

npm install -g backport

After installation you should add an access token to the global config in ~/.backport/config.json. See the documentation for how the access token is generated.

Quick start

npm install backport

Add a project config to the root of your repository:

// .backportrc.json
{
  // Required
  "repoOwner": "elastic",
  "repoName": "kibana",

  // the branches available to backport to
  "targetBranchChoices": ["main", "6.3", "6.2", "6.1", "6.0"],

  // Optional: automatically merge backport PR
  "autoMerge": true,
  "autoMergeMethod": "squash",

// Optional: Automatically detect which branches a pull request should be backported to based on the pull request labels. // In this case, adding the label "auto-backport-to-production" will backport the PR to the "production" branch "branchLabelMapping": { "^auto-backport-to-(.+)$": "$1" } }


Add personal access token to [global config](/docs/configuration.md#global-config-backportconfigjson):