GithubHelp home page GithubHelp logo

thaligar / gitlab-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vishwanatharondekar/gitlab-cli

0.0 1.0 0.0 96 KB

Create a merge request from command line in gitlab

License: MIT License

JavaScript 100.00%

gitlab-cli's Introduction

gitlab-cli

gitlab-cli is a command line utility created in JavaScript. Inspired from hub. It tries to provide commands which makes working with gitlab from the command line easier.

Creating a merge request with gitlab-cli is as simple as

$ lab merge-request

Installation

Install it using npm

$ npm install git-lab-cli -g

Usage

$ lab command [options]

To get a list of available commands

$ lab --help

Commands available

browse                    Open current branch page in gitlab
compare [options]         Open compare page between two branches
merge-request [options]   Create merge request on gitlab
merge-requests [options]  Opens merge request page for the repo.

Check help of each command like following

$ lab merge-request --help

Running example

$ lab merge-request -b feature/feature-name -t develop

Above will create merge request for merging feature/feature-name in develop.

Options for create-merge-request

-b, --base [optional]                  Base branch name
-t, --target [optional]                Target branch name
-m, --message [optional]               Title of the merge request
-a, --assignee [optional]              User to assign merge request to
-l, --labels [optional]                Comma separated list of labels to assign while creating merge request
-r, --remove_source_branch [optional]  Flag indicating if a merge request should remove the source branch when merging
-s, --squash [optional]                Squash commits into a single commit when merging
-e, --edit [optional]                  If supplied opens edit page of merge request. Opens merge request page otherwise
-p, --print [optional]                 If supplied print the url of the merge request. Opens merge request page otherwise
-v, --verbose [optional]               Detailed logging emitted on console for debug purpose
-h, --help                             output usage information

Configurations

gitlab-cli captures configurations needed for itself on the first run. Just run the command you want to run and it will capture the information needed.

You can also set the configurations yourself as git config (project specific) or environment variables (global).

git config

Setting git config allows you to provide separate configurations for each gitlab repository.

$ git config --add gitlab.url "https://gitlab.yourcompany.com"
$ git config --add gitlab.token "abcdefghijskl-1230"

Find your gitlab token at https://gitlab.yourcompany.com/profile/account

Environment variables

Setting environment variables allows you to provide global configurations which will be used for all your gitlab repositories when using gitlab-cli.

GITLAB_URL=https://gitlab.yourcompany.com
GITLAB_TOKEN=abcdefghijskl-1230

Find your gitlab token at https://gitlab.yourcompany.com/profile/account

Features supported

  1. Base branch is optional. If base branch is not provided. Current branch is used as base branch.
  2. Target branch is optional. If target branch is not provided, default branch of the repo in gitlab will be used.
  3. Created merge request page will be opened automatically after successful creation.
  4. If title is not supported with -m option value. It will be taken from in place editor opened. First line is taken as title.
  5. In place editor opened contains latest commit message.
  6. In the editor opened third line onwards takes as description.
  7. Comma separated list of labels can be provided with its option.
  8. Supports forks. If base branch and target branch are on different remotes. Merge request will be created between forks.
  9. Supports setting assignee for merge request.

gitlab-cli's People

Contributors

beckje01 avatar mathroc avatar stevelacey avatar vishwanatharondekar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.