Git Productivity

git-branch-janitor

Local branches pile up fast. This tool finds every branch already merged into main and cleans them up in one command.

View on GitHub See Usage
terminal
$ pip install git-branch-janitor
How it works

Three steps, zero mess

1

Detect merged branches

Runs git branch --merged <base> to get every branch fully merged into your base branch.

2

Filter protected branches

Automatically skips main, master, develop, staging, production, and your currently active branch.

3

Delete safely

Uses git branch -d (safe delete) so it will never remove a branch with unmerged work.

Usage

See it in action

$ git-janitor --dry-run ๐ŸŒฟ Merged branches (base: main): feature/login-page fix/typo-in-readme chore/update-deps [dry-run] 3 branch(es) would be deleted. No changes made. $ git-janitor --yes ๐Ÿ—‘๏ธ Deleted branch 'feature/login-page' ๐Ÿ—‘๏ธ Deleted branch 'fix/typo-in-readme' ๐Ÿ—‘๏ธ Deleted branch 'chore/update-deps' Done. 3 deleted, 0 failed.