Socket
Socket
Sign inDemoInstall

remove-merged-branches

Package Overview
Dependencies
9
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    remove-merged-branches

Removes merged git branches


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
1.33 MB
Created
Weekly downloads
 

Readme

Source

remove-merged-branches

Node.js CI

Command line tool removing all branches that have been merged to the current branch.

Supports dry runs and offline use.

It can be used to remove both local and remote branches.

Usage

Install globally:

npm i -g remove-merged-branches

And then you just call:

rmb

...or if you prefer verbosity, enter remove-merged-branches

Syntax

Usage: rmb [options]

Removes merged branches locally and remotely

Options:
  -V, --version          output the version number
  -b, --branch <branch>  Base branch to compare others to (default: "HEAD")
  -o, --offline          Runs without doing anything to remotes (default: false)
  --verbose              Shows more output (default: false)
  --dry-run              Performs a dry run instead of removing branches (default: false)
  -h, --help             output usage information

What does it do?

First it clears out the local branches that have been removed on the remotes:

git fetch --prune

Then, it finds all local branches merged to the HEAD branch and removes them:

git branch --merged $(git rev-parse HEAD)
# Then calls 'git branch -d' on each merged branch

Then, it finds all remote branches merged to the HEAD branch and removes them:

git branch --remote --merged $(git rev-parse HEAD)
# Then call 'git push --no-verify --delete' on each origin and branch

Finally, it clears out the local branches that have been removed due to the previous action:

git fetch --prune

Example output

INFO Pruning branches removed on remotes
INFO Removing local branch feature/add-badges-to-markdown, feature/add-more-time-logs, feature/change-ci, feature/refactor-ssh-exec-cmd, refactor/extract-remove-undefineds
INFO No remote merged branches to HEAD found
INFO Pruning branches removed on remotes

Keywords

FAQs

Last updated on 15 Nov 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc