vanjacosic / backport

Automate the tedious process of backporting commits to version branches

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

backport

Build Status dependencies Status Coverage Status NPM version code style: prettier

A simple CLI tool for backporting commits

Demonstration gif

Install

npm install -g backport

Usage

> backport

Options

Option Description Accepts
--multiple Backport multiple commits and/or branches boolean
--multiple-commits Backport multiple commits boolean (defaults to false)
--multiple-branches Backport to multiple branches boolean (defaults to true)
--own Only show own commits boolean (defaults to true)
--show-config Show configuration
--sha Commit sha to backport string
--help Show help
-v, --version Show version number

Configuration

Global Config

The first time you run backport a skeleton configuration file will be created in /<homedir>/.backport/config.json. You need to update the config file with your Github username and a Github Access Token (can be created here).

View "config.json" sample
{
  // Github personal access token. Create here: https://github.com/settings/tokens/new
  // Please check "Full control of private repositories"
  "accessToken": "",

  // Github username, eg. kimchy
  "username": "",

  // Override project-specific setting
  "projects": [
    {
      "upstream": "elastic/kibana",
      "branches": ["6.x", "6.1", "6.0"]
    }
  ]
}

Project-specific config

Add .backportrc.json to the root of your project with the following structure:

View ".backportrc.json" sample
{
  "upstream": "elastic/kibana",

  // You can pre-select branches you use often
  "branches": [
    { "name": "6.x", "checked": true },
    { "name": "6.1", "checked": true },
    "6.0"
  ],

  // Only allow picking own commits to backport
  "own": true,

  // Backport multiple commits
  "multipleCommits": false,

  // Backport to multiple branches
  "multipleBranches": true,

  // Labels will be added to the PR
  "labels": ["backport"]
}

Troubleshooting

backport never touches your local repositories or files. Instead a separate clone of your repositories are created in /<homedir>/.backport/repositories/. This is also where you'll need to solve merge conflicts. If you are experiencing issues, you can try deleting the repository, or the entire .backport folder - it will be recreated next time you run backport.

About

Automate the tedious process of backporting commits to version branches

License:Apache License 2.0


Languages

Language:JavaScript 100.0%