git-branch-cli

A client for creating git branch easily using interactive questions.

Usage no npm install needed!

<script type="module">
  import gitBranchCli from 'https://cdn.skypack.dev/git-branch-cli';
</script>

README

Git Branch CLI

npm version npm downloads gitmoji badge

A client for creating git branch easily using interactive questions.

git_branch_cli_demo

Features

  • Easy to use
  • Interactive prompt
  • Fully configurable

Install

For global use :

$ yarn global add git-branch-cli

Or

$ npm install -g git-branch-cli

For local use :

$ yarn add git-branch-cli

Or

$ npm install git-branch-cli

Add to package.json file :

"scripts": {
  "git-branch": "git-branch"
}

Usage

If installed globally :

git-branch

If installed locally :

yarn run git-branch

or

npm run git-branch

A client for creating git branch easily using interactive questions.
    
  Usage
    $ git-branch
    
  Options
    --init, -i        Initialize a new branch
    --version, -v     Print git-branch-cli installed version

Configuration

The configuration for using git-branch-cli should be located in the package.json file.

Example :

"git-branch-cli": [
    {
        "name": "type",
        "message": "What type is your branch ?",
        "type": "autocomplete",
        "choices": [
            "feature",
            "bug"
        ],
        "characterAfter": "/"
    },
    {
        "name": "name",
        "message": "What is the name of the feature ?",
        "characterAfter": "-"
    },
    {
        "name": "ticket",
        "message": "What is the ticket number ?",
        "type": "number"
    }
]

name (required)

Type: string

Only for understanding the configuration

message (required)

Type: string

The question that will be displayed

type

Type: string

Type of the answer.

Defaults: input - Possible values: input, number, autocomplete.

choices (required if type field is autocomplete)

Type: array

The different choices for the user

characterAfter

Type: char

The character that will be positioned after the user's slugified answer

required

Type: bool

Determine if user's answer can be blank. If this field is false and the user's answer is blank, the characterAfter value isn't add to branch name.

Defaults: true

Credits

Created by Théo Frison, inspired and taken for some parts from this project.