keep-branches is a CLI tool used to prune local git repository of unwanted branches.
The tool will prune branches that are
- not
main - not the current branch
- not listed as an argument
The keep-branches tool is available to download from the Releases page.
It is pre-compiled for many operating systems and architectures including
- Linux
- Windows
- MacOS
- FreeBSD
- OpenBSD
The keep-branches command can be compiled from source using the Go tool chain.
Short version:
go install github.com/shoenig/keep-branches@latestKeep only main
keep-branchesKeep main, x-my-branch, x-foo-branch
keep-branches x-my-branch x-foo-branchPrint help message
keep-branches -helpThe github.com/shoenig/keep-branches command is always improving with new
features and bug fixes. For contributing please file an issue or pull request.
The github.com/shoenig/keep-branches command is open source under the MIT license.