Github CLI extension
Safely delete local branches that have no remotes and no hanging changes.
The extension uses git branch -d
to delete the local branches, hence it will not delete branches with un-pushed changes
unless using --force
flag.
The extension supports single or multiple upstream.
gh extension install davidraviv/gh-clean-branches
Execute it inside a git repo folder:
gh clean-branches [--dry-run] [--force] [--verbose]
--dry-run
See the list of branches to be deleted before actually deleting them.--force
Uses git branch -D
forcing a branch to be deleted regardless if upstream branches have local changes. Use carefully!--verbose
Print all log statements.main
) and pull changes (needed if we want to delete the current branch)--verbose
flag)--verbose
flag)--dry-run
)The extension depends on: