# gitlab-merge

> Tool to create merge request on gitlab from terminal

Latest version **1.1.2** (published 2018-12-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install gitlab-merge
pnpm add gitlab-merge
yarn add gitlab-merge
bun add gitlab-merge
```

Provides the command `gitlab-merge`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2018-12-20 |
| First published | 2018-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 8 |
| Unpacked size | 46.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 47 |
| Author | Christian Varisco |
| Maintainers | cvarisco |

## Links

- npm: https://www.npmjs.com/package/gitlab-merge
- Repository: https://github.com/CVarisco/gitlab-merge
- Homepage: https://github.com/CVarisco/gitlab-merge#readme
- Issues: https://github.com/CVarisco/gitlab-merge/issues
- npm.io page: https://npm.io/package/gitlab-merge

## Dependencies (8)

- [ora](https://npm.io/package/ora.md) 1.4.0
- [chalk](https://npm.io/package/chalk.md) 2.1.0
- [inquirer](https://npm.io/package/inquirer.md) 6.2.0
- [ascii-art](https://npm.io/package/ascii-art.md) 1.5.0
- [git-branch](https://npm.io/package/git-branch.md) 2.0.1
- [cosmiconfig](https://npm.io/package/cosmiconfig.md) 3.1.0
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) 6.26.0
- [request-promise](https://npm.io/package/request-promise.md) 4.2.2

## Recent versions

- 1.1.2 (latest) — 2018-12-20
- 1.1.1 — 2018-12-20
- 1.1.0 — 2018-12-14
- 1.0.1 — 2018-12-04
- 1.0.0 — 2018-11-23
- 0.0.2 — 2018-11-23
- 0.0.1 — 2018-11-23

## README

<p align="center">
  <img src="https://github.com/CVarisco/gitlab-merge/blob/master/docs/logo.png" width="500" alt="gitlab-merge"/>
</p>

<p align="center">
<strong align="center">First Gitlab guided CLI to create your merge request from terminal</strong><br>
Don't change anymore context to open a merge request 👨🏻‍💻
</p>

<br>

<p align="center">

[![npm version](https://badge.fury.io/js/gitlab-merge.svg)](https://badge.fury.io/js/gitlab-merge)
[![Maintainability](https://api.codeclimate.com/v1/badges/7698738e69089d536da0/maintainability)](https://codeclimate.com/github/CVarisco/gitlab-merge/maintainability)
[![npm](https://img.shields.io/npm/dw/gitlab-merge.svg)](https://www.npmjs.com/package/gitlab-merge)
[![Build Status](https://travis-ci.org/CVarisco/gitlab-merge.svg?branch=master)](https://travis-ci.org/CVarisco/gitlab-merge)

</p>

<p align="center">
  <img src="https://github.com/CVarisco/gitlab-merge/blob/master/docs/gitlab-merge-example.gif" alt="gitlab-merge" width="1024" />
</p>

## Install

```sh
$ npm install -g gitlab-merge
```

## Usage

Create your configuration file.
`gitlab-merge` uses [cosmiconfig](https://github.com/davidtheclark/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.

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

Launch from terminal:

```sh
$ 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?](#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?](#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                                                                                                                                                                                                                                                                      |
| `assignee_id`   | Optional Assignee id of the merge request. If you put `none` the MR will be unassigned                                                                                                                                                                                                                         |

**You can add to your config file the options that you want**, [here](https://docs.gitlab.com/ee/api/merge_requests.html#create-mr) is the list.

### Where can I generate the private token?

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

<p align="center">
  <img src="https://github.com/CVarisco/gitlab-merge/blob/master/docs/api_token.png" alt="gitlab-merge" width="1024" />
</p>

### 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.

<p align="center">
  <img src="https://github.com/CVarisco/gitlab-merge/blob/master/docs/project_id.png" alt="gitlab-merge" width="1024" />
</p>

## Contributing

Check the [issue list](https://github.com/CVarisco/gitlab-merge/issues) 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](http://semver.org/).

Use `npm run watch` while coding.

### [Contributors](https://github.com/CVarisco/gitlab-merge/graphs/contributors)

## License

MIT © [Christian Varisco](https://github.com/CVarisco)

---
_Source: https://npm.io/package/gitlab-merge · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
