# gbkill

> 🤡 Delete git branches in batches 🤡

Latest version **0.0.1-beta.6** (published 2024-07-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install gbkill
pnpm add gbkill
yarn add gbkill
bun add gbkill
```

Provides the command `gbkill`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1-beta.6 |
| Published | 2024-07-30 |
| First published | 2024-01-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=16.20.0 |
| Dependencies | 15 |
| Unpacked size | 45.9 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | AKclown |
| Maintainers | akclown |
| Keywords | cli, git, npm, clean, tool, delete |

## Links

- npm: https://www.npmjs.com/package/gbkill
- Repository: https://github.com/AKclown/gbkill
- Homepage: https://github.com/AKclown/gbkill#readme
- Issues: https://github.com/AKclown/gbkill/issues
- npm.io page: https://npm.io/package/gbkill

## Dependencies (15)

- [ink](https://npm.io/package/ink.md) ^4.4.1
- [axios](https://npm.io/package/axios.md) ^1.6.7
- [react](https://npm.io/package/react.md) ^18.2.0
- [colors](https://npm.io/package/colors.md) ^1.4.0
- [figlet](https://npm.io/package/figlet.md) ^1.7.0
- [semver](https://npm.io/package/semver.md) ^7.5.4
- [inquirer](https://npm.io/package/inquirer.md) ^8.2.6
- [url-join](https://npm.io/package/url-join.md) ^5.0.0
- [commander](https://npm.io/package/commander.md) ^11.1.0
- [simple-git](https://npm.io/package/simple-git.md) ^3.22.0
- [sudo-block](https://npm.io/package/sudo-block.md) ^5.0.0
- [ink-spinner](https://npm.io/package/ink-spinner.md) ^5.0.0
- [ansi-escapes](https://npm.io/package/ansi-escapes.md) ^6.2.0
- [ink-gradient](https://npm.io/package/ink-gradient.md) ^3.0.0
- [downgrade-root](https://npm.io/package/downgrade-root.md) ^2.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.0.1-beta.6 (latest) — 2024-07-30
- 0.0.1-beta.5 — 2024-02-02
- 0.0.1-beta.4 — 2024-02-02
- 0.0.1-beta.3 — 2024-02-02
- 0.0.1-beta.2 — 2024-02-02
- 0.0.1-beta.1 — 2024-02-02
- 0.0.1-bate — 2024-01-31

## README

## 🤡 Delete git branches in batches [中文版](https://github.com/AKclown/gbkill/blob/main/README-ZH.md)

<p align="center">
<img alt="npm" src="https://img.shields.io/npm/dy/gbkill.svg">
<img alt="npm version" src="https://img.shields.io/npm/v/gbkill.svg">
<img alt="NPM" src="https://img.shields.io/npm/l/gbkill.svg">
</p>

In daily development, we create a git branch function every time we make a requirement. Over time, many local and online branches will be accumulated. Then it is particularly important to have a tool to delete git branches in batches at this time. **`GBKILL` is a tool created to solve this need, allowing you to delete git branches more efficiently**

> ![gbkill](./docs/gbkill.gif)

> This tool will list the `git branches` in the projects, and then you can `select in batches` the `git branches` that need to be deleted.

> ![logo.png](./docs/logo.png)

## 🤡 Install

Actually you don't need to install it to use it! Just use the following command:

```ts
$ npx gbkill
```

Or you can install it:

```ts
$ npm i -g gbkill
```

## 🏕️ Usage

> Enter `gbkill` in your `terminal`** (currently not compatible with Git in Windows terminal)**. `gbkill` will execute the `git command` to scan the `git branches` under your current project s and display them in the lists

| Key        | Description                                                                                                         |
| ---------- | ------------------------------------------------------------------------------------------------------------------- |
| Space      | Press the `spacebar` to execute the `merged` branch deletion (**`recommendation: to prevent accidental deletion`**) |
| Tab        | Press the `Tab` to execute `merged \| unmerged` branch deletion (**`higher permissions than the Space`**)           |
| RightArrow | Press `-> ` to execute `Open \| Close`function of batch selection branch                                            |
| ↓          | Press `↓` to select branch                                                                                          |
| ↑          | Press `↑` to select branch                                                                                          |

**Hint**

> 1. The `merge` listed on the gbkill interface displays `yes` or `No` which is judged by `git branch --merged <name>`. You can specify the merged branch name by executing `gbkill --merged <name>`

> 2. When the `merge` status in `gbkill` is `yes`, but `NO_FORCE...fully merged` appears when you delete the branch. Reason: `The code of this branch` is not merged into the `currently focused branch`. Requires `forced deletion`

> 3. When executing `gbkill --sync`, the `remote branch` of the target branch will be deleted first and then the `local branch`

## 🏖️ Parameter

> Configurable parameters of `gbkill`. Some configuration parameters will be cached and shared globally in the `/user home directory/.gbkill` file.

| Argument             | Description                                                                                                                                                        | Cache |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
| --force              | Forcibly delete a branch, equivalent to `git branch -D \<name\>` (**Caution: local `commit` changes will be deleted**)                                             | No    |
| --sync               | Whether to delete remote branches synchronously                                                                                                                    | No    |
| --merged \<name\>    | Specify the branch name used to determine whether a branch has been merged (**git branch --merged \<name\>**)                                                      | Yes   |
| --lock \<names..\>   | `Locked` some branches will be `hidden in the list`, and the data will be accumulated instead of replaced (**Prevent accidental deletion, protect some branches**) | Yes   |
| --unlock \<names..\> | `Unlock` a branch locked by `--lock`                                                                                                                               | Yes   |

<!-- | --submodule          | Whether to display the branch list of git submodules                                                         | No    | -->
<!-- | --language \<name\>  | Specify GBkill language `ZH\|EN`                                                           | Yes    | -->

## 🏝️ State of Git branch

> Description corresponds to branch status.

| Status    | Description                                                              | Color |
| --------- | ------------------------------------------------------------------------ | ----- |
| NONE      | The branch is in a normal state                                          |       |
| DELETING  | Branch is being deleted                                                  | 🌍    |
| DELETED   | Branch deleted                                                           | 🟢    |
| FAILED    | Fail to delete branch                                                    | 🔴    |
| NO_MERGED | The branch was not merged into `name branch` (`--merged <name>`)         | 🟣    |
| NO_FORCE  | This branch needs to be forcibly deleted `git branch -D name`(`--force`) | 🟡    |
| NO_SYNC   | Fail to delete remote branches synchronously                             | 🟠    |

## 🏞️ Known issues

> ⚠️ `Git for Windows Terminal` is currently not supported, and the tool is limited to [ink](https://github.com/vadimdemedes/ink/issues/378). We will look for alternatives later. Please use `CMD`, `Vscode terminal's Git...` terminal

## ⛺ Other

1. This tool will be continuously optimized. If you have better ‘interactive behavior’ or ‘feature requests’, you can submit a ‘pr’ or ‘issue’ to me
2. Thank you for using this tool and looking forward to your `issue` or `PR`

<!-- 请勿删除: [EMO 图形地址](https://emojipedia.org/zh) -->

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