
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
git-prune-branches
Advanced tools
Delete local git branches that have been merged and removed on the remote
List or remove local tracked branches, which are deleted from the remote.
It's a fork of git-removed-branches with an interactive prompt, and the ability to retry deleting branches with --force
Addresses questions, like:
Because I'm tired of doing every time git fetch -p
, git branch -r
, git branch
and keep comparing which branches are gone from the GitHub, but still available locally and doing git branch -D ${branch_name}
on each of them, one by one.
This command will compare your local branches with remote and show you branches that are no longer available on remote but are still presented in your local repository. You can also use it to view and delete all (remotely) removed branches in one go using --prune-all
flag.
This command works without the need to run git fetch -p
, but a working network connection to your remote is required. If no connection can be established with the remote repository, then local information about your remote will be used instead. If your local repository is not in sync with the remote repository, it will warn you about it.
npm install -g git-prune-branches
Please install a package globally with -g flag so that you can use it directly as a sub command of git, like this:
git prune-branches
It's also possible to use package through npx
without installing:
npx git-prune-branches
git prune-branches
This command will look through the branches that are no longer available on the remote and display them.
In case you haven't run git fetch -p
, it will warn you to do so.
To delete all local branches without choosing which ones, and without confirmation, use --prune-all
or -p
flag
git prune-branches --prune-all
This command will compare your local branches to the remote ones and remove, those which do not exist anymore on the remote side.
If you have configured remote alias to something different than 'origin', you can use --remote
or -r
flag to specify the name of the remote. e.g., to specify remote to be upstream
, you can use:
git prune-branches --remote upstream
If you get an error when trying to delete branches:
The branch {branch_name} is not fully merged.
you can force deletion by using --force
flag or the -f
alias
git prune-branches --prune-all --force
--force
If any branches fail to delete when the --force
flag is not used, git-prune-branches
will offer to retry and delete them again using --force
.
You can skip the confirmation prompts with --yes
or the shortcut -y
:
git prune-branches -y
To print the version:
git prune-branches --version
If you encounter error ERR_CHILD_PROCESS_STDIO_MAXBUFFER
it is possible that your repository contains too many branches (more then 3382—see discussion).
You can fix this by specifying NODE_MAX_BUFFER environment variable. For example:
NODE_MAX_BUFFER=1048576 git prune-branches
This project uses Vitest for testing. The tests create a temporary git repository and verify the behavior of the tool in different scenarios.
pnpm test
pnpm test:once
Build the TypeScript source:
pnpm build
pnpm lint
pnpm format
Forked from git-removed-branches by Maks Nemisj @nemisj
FAQs
Delete local git branches that have been merged and removed on the remote
The npm package git-prune-branches receives a total of 7 weekly downloads. As such, git-prune-branches popularity was classified as not popular.
We found that git-prune-branches demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.