npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

clear-branches

v1.0.3

Published

easy way to clear your local branches

Downloads

11

Readme

clear-branches

Productive and easy way to clear your local git branches

Getting started

Overview

It's recommended for you who:

  • Usually struggle in clearing your local git branches.
  • Anyone that doesn't have the habit of deleting the branches constantly and gets crazy managing a lot of branches.
  • Prefer using a terminal rather than a Git GUI Client.

Motivation

I implemented this code once ago, as a tiny and ugly script only to help me to be more productive. And I realized that some colleagues were looking for something like this and I've published it to be available to anyone else to use and contribute.

Requirement

Recommended node version equal to or greater than v16

Quick start

You don't need to install it globally, if the idea is to use it sometimes, you can just execute it into your git project, so that you will execute the latest stable version.

$ npx clear-branches@latest

Or install it on your machine:

yarn:

$ yarn global add clear-branches

npm:

$ npm i -g clear-branches

output

Now clear-branches is executable anywhere you want, if you try into your project you will see the list of branches it will delete and a confirmation message:

$ clear-branches
  feat/component
  feat/feature
  fix/functions
? Are you sure you want to delete listed branches above? › (y/N)

Advanced options

Considering a project with these branches:

  feat/component
  feat/feature
  fix/functions
  main
  release

clear-branches --force=<branch>[,<branch>]

It force ignored branches by default to be considered to clear.

By default, clear-branches ignores these branches.

  main
  master
  release
  develop

*The current branch is ignored and is not possible to force delete it

Using clear-branches --force=<branch>[,<branch>], you will be able not to ignore any of these branches.

I.e.:

$ clear-branches --force=main
  feat/component
  feat/feature
  fix/functions
  main  # <-- now main is in the list to deleted
? Are you sure you want to delete listed branches above? › (y/N)

clear-branches --ignore=<branch>[,<branch>]

It ignores the branches you don't want to delete.

I.e.:

$ clear-branches --ignores=feat/component,feat/feature
  fix/functions
? Are you sure you want to delete listed branches above? › (y/N)

In this example, feat/component and feat/feature won't be deleted.

clear-branches --ignore-pattern=<pattern>

It ignores all branches that match a regex.

I.e.:

$ clear-branches --ignores=feat\/\\w+
  fix/functions
? Are you sure you want to delete listed branches above? › (y/N)

_As both feat/component and feat/feature match the feat\/\\w+ regex, they won't be deleted.

It's needed to escape if you need to use \, like \\w+

clear-branches -i, --interactive

With this option, you can select the branch you want to delete.

I.e.:

$ clear-branches -i --force=release,main
? Choose the branches you want to delete: ›
Instructions:
    ↑/↓: Highlight option
    ←/→/[space]: Toggle selection
    a: Toggle all
    enter/return: Complete answer
◉   feat/component
◉   feat/feature
◯   fix/functions
◯   release
◯   main

After pressing Enter:

$ clear-branches -i --force=release,main
✔ Choose the branches you want to delete: › feat/component, feat/feature
? Are you sure you want to delete listed branches above? › (y/N)

Contributing

Cloning and running

Testing

Architecture

Issues

To comfortable start contributing to this project, it is encouraged you go for this list of good start issues:

More labels

Contributors

  • https://github.com/jmlavoier