This CLI app deletes local branches that have been merged also "Squash and merge".
It is based on https://github.com/nekonenene/git-branch-delete-merged written in the Go language, and rewritten in the Rust language.
macOS or Linux can install through Homebrew.
# Install
brew install nekonenene/tap/git-branch-delete-merged
# Update
brew update && brew upgrade git-branch-delete-merged
# Uninstall
brew remove git-branch-delete-merged
macOS or Linux can do the following.
# Install / Update
curl -fL https://github.com/nekonenene/git-branch-delete-merged-rs/releases/latest/download/git-branch-delete-merged_$(uname -s)_$(uname -m) -o git-branch-delete-merged && chmod +x git-branch-delete-merged
mv git-branch-delete-merged /usr/local/bin
# Uninstall
rm /usr/local/bin/git-branch-delete-merged
After installing cargo,
# Install
cargo install --git https://github.com/nekonenene/git-branch-delete-merged-rs
# Update
cargo install --force --git https://github.com/nekonenene/git-branch-delete-merged-rs
# Uninstall
cargo uninstall git-branch-delete-merged
If you want to delete a branch that has merged into the main
branch:
git-branch-delete-merged main
And if the branch to delete exists, you will get a prompt like this:
Found 2 merged branches: [dev1 dev2]
Are you sure to delete 'dev1' branch? [y|n|l|d|q|help]:
Please type one and press enter.
y
: Yes, delete the branchn
: No, skip deletingl
: Show git logs of the branchd
: Show the latest commit of the branch and its diffq
: Quit immediatelyh
: Show help
If you want to delete all merged branches without confirmations, --yes
option will be useful.
git-branch-delete-merged main --yes
not-an-aardvark/git-delete-squashed is the reference code that helps finding branches which has squashed and merged.