Delete all branches except the specified branch.
- Unix-like operating system (Linux or macOS)
- Git
go install github.com/yuzoiwasaki/sweep@latest
or
# For Linux (amd64)
curl -fLo /usr/local/bin/sweep \
https://github.com/yuzoiwasaki/sweep/blob/master/bin/sweep
# For macOS Intel
curl -fLo /usr/local/bin/sweep \
https://github.com/yuzoiwasaki/sweep/blob/master/bin/sweep-darwin-amd64
# For macOS Apple Silicon
curl -fLo /usr/local/bin/sweep \
https://github.com/yuzoiwasaki/sweep/blob/master/bin/sweep-darwin-arm64
Delete all branches except main.
sweep
Delete all branches except foo.
sweep -v foo