• Stars
    star
    237
  • Rank 163,900 (Top 4 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 29 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple CLI tool that automates the process of backporting commits on a GitHub repo

A CLI tool that automates the process of backporting commits.


๐ŸŽ‰ 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

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

backport-demo

Requirements

  • Node 16 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:

// ~/.backport/config.json
{
  "accessToken": "ghp_very_secret"
}

Run:

npx backport

This will start an interactive prompt. You can use your keyboards arrow keys to choose options, <space> to select checkboxes and <enter> to proceed.

Documentation

What is backporting?

Backporting is the action of taking parts from a newer version of a software system [..] and porting them to an older version of the same software. It forms part of the maintenance step in a software development process, and it is commonly used for fixing security issues in older versions of the software and also for providing new features to older versions.

Source: https://en.wikipedia.org/wiki/Backporting

Who is this tool for?

This tools is for anybody who is working on a codebase where they have to maintain multiple versions. If you manually cherry-pick commits from master and apply them to one or more branches, this tool might save you a lot of time.

backport is a CLI tool that will let you backport commit(s) interactively and then cherry-pick and create pull requests automatically. backport will perform all git operations in a temporary folder (~/.backport/repositories/) separate from your working directory, thereby never interfering with any unstages changes your might have.

Features:

  • interactively backport one or more commits to one or more branches with an intuitive UI
  • ability to see which commits have been backported and to which branches
  • ability to customize the title, description and labels of the created backport PRs
  • all git operations are handled in a separate directory to not interfere with unstaged files
  • Conflicts are handled gracefully, and hints are provided to help the user understand the source of the conflict
  • backport a commit by specifying a PR: backport --pr 1337
  • list and backport commits by a particular user: backport --author john
  • list and backport commits by a particular path: backport --path src/plugins/chatbot
  • list PRs filtered by a query: backport --pr-filter label:backport-v2 (will list commits from PRs with the label "backport-v2")
  • forward port commits: backport --source-branch 7.x --branch master (will forwardport from 7.x to master)
  • backport merge commits: backport --mainline

Contributing

See CONTRIBUTING.md

More Repositories

1

fb-sleep-stats

Use Facebook to track your friendsโ€™ sleeping habits
JavaScript
1,576
star
2

alfred-currency

Workflow for Alfred to quickly lookup and convert currencies
PHP
80
star
3

await-sleep

Delay with async/await
JavaScript
39
star
4

github-widescreen

Chrome extension to toggle the width of Github
CSS
32
star
5

eslint-compare

A tool to visually compare differences between ESLint configurations
JavaScript
31
star
6

freedom

DEPRECATED. Freedom Calendar - FAAS (Filter As A Service) for Facebook Events
PHP
25
star
7

backport-github-action

Backport CLI tool as a Github Action
TypeScript
22
star
8

fb-sleep

Simple module to retrive a list of Facebook friends, and when they were last online
JavaScript
16
star
9

frametalk

Simple postMessage wrapper to make cross-frame communication easy as pie. Supports promises and return values. (No dependencies)
JavaScript
11
star
10

countdown.run

A modern countdown for the web. Offline support, "close-tab-resistant" and simple.
JavaScript
8
star
11

ocr-nemid

Store NemId digitally and easily find the codes you need
JavaScript
6
star
12

react-router-breadcrumb-example

Example of creating breadcrumbs in react-router 4
JavaScript
6
star
13

anybase-calculator

Calculator for any numeral system (binary, octal, decimal, hex etc.)
JavaScript
5
star
14

react-redux-request

Declarative data fetching for React, stored in Redux.
JavaScript
4
star
15

fave-scraping

Scraping of public interfaces without a proper API like Yelp and Google for Geocoding
JavaScript
3
star
16

huemon

Monitor Philips Hue lights with Elasticsearch and Kibana
TypeScript
3
star
17

cpr-calculator

Calculates all possible Danish social security numbers for a birthday
JavaScript
3
star
18

tsapi-electron

Postman-like app, but with configuration files...
CSS
2
star
19

backport-server

Automatically backport pull request
TypeScript
2
star
20

logs-onboarding-demo-app

Demo app for producing logs
JavaScript
2
star
21

eurovision-2014

JavaScript
2
star
22

synthbeans-node

A tool to generate predictable APM data making it easier to spot calculation errors in APM ui.
TypeScript
2
star
23

pr-push-action

Run a command on a PR that causes to update. The change is then committed.
TypeScript
2
star
24

huskbarnet.dk

JavaScript
2
star
25

tradeshift-mobile

Lets be honest - invoicing sucks and no sane person wants to do it. The only reason we still have invoices today is because no one bothered to break out of the restrictions introduced years ago by this legacy format called paper. And we're kinda past that now, so lets just move on and we can all forget about the craziness of invoices, credit notes, purchase orders, remittance advice and other concepts we really don't want to take up space in our heads. We will be building a mobile first application that automates all the legal requirements around invoicing (using tradeshifts public api), based on sensible, structured human-to-human communication.
CSS
2
star
26

github-action-playground

Testing out github action capabilities
JavaScript
1
star
27

medlems-klubben.dk

CSS
1
star
28

github-dashboard

JavaScript
1
star
29

2019-june-typescript-presentation

Presentation at Elastic about Typescript "stuff"
1
star
30

didibackport

JavaScript
1
star
31

projectidentity

CoffeeScript
1
star
32

eurovision-scrape-2014

JavaScript
1
star
33

fave-frontend

Java
1
star
34

lyft-surge-pricing

JavaScript
1
star
35

fb-leak

JavaScript
1
star