34

I made a guided CLI to create your merge request for Gitlab from your terminal

 5 years ago
source link: https://www.tuicool.com/articles/hit/mAVjqeR
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

aem26n3.png!web

First Gitlab guided CLI to create your merge request from terminal

Don't change anymore context to open a merge request :man|type_1_2:‍:computer:

gitlab-merge-example.gif

Install

$ npm install -g gitlab-merge

Usage

Create your configuration file. gitlab-merge uses cosmiconfig for configuration file support. This means you can configure cca via:

  • A .gitlab-mergerc file, written in YAML or JSON, with optional extensions: .yaml/.yml/.json .
  • A gitlab-merge.config.js file that exports an object.
  • A "gitlab-merge" key in your package.json file.

The configuration file will be resolved starting from the root of your project, and searching up the file tree until a config file is (or isn't) found.

{
  "api_link": "https://gitlab.example.com/api/v4/",
  "private_token": "XXX"
}

Launch from terminal:

$ cd ~/my-projects
$ gitlab-merge

Configuration

Currently supported options are:

Option Description api_link Mandatory Api link of the gitlab host private_token Mandatory Your private token generated from gitlab.Where can I generate the private token? project_id Optional Project id for the destionation of the merge request. If you don't set the project_id in the configuration file the tool at the beginning fetch ALL the list of the project hosted to the api_link provided.Where can I find the project id in Gitlab? source_branch Optional From which branch the merge request come from (default the local active branch) target_branch Optional Target branch to merge changes title Optional Title of the merge request description Optional Description of the merge request

Where can I generate the private token?

Very simple! go to your user settings in Gitlab at ´ https://XXXXXXX/profile´

Yz6f6jQ.png!web

Where can I find the project id in Gitlab?

You can find the project id of your project in the details tab of the repo.

Rva2Uf3.png!web

Contributing

Check the issue list to contribute on some activities or to advice new features! The library is open to everybody, contribute improve your skills.

gitlab-merge is maintained under the Semantic Versioning guidelines .

Use npm run watch while coding.

Contributors

License

MIT © Christian Varisco


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK