Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
clear-branches
Advanced tools
Productive and easy way to clear your local git branches
It's recommended for you who:
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.
Recommended node version equal to or greater than v16
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)
Considering a project with these branches:
feat/component
feat/feature
fix/functions
main
release
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)
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.
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+
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)
To comfortable start contributing to this project, it is encouraged you go for this list of good start issues:
More labels
FAQs
easy way to clear your local branches
We found that clear-branches demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.