Created
July 30, 2020 04:09
-
-
Save peterpme/7cf8be2dc44d3da809e061111875d1f3 to your computer and use it in GitHub Desktop.
Interactive git branch delete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fbd - delete git branch (including remote branches) | |
fbd() { | |
local branches branch | |
branches=$(git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format="%(refname:short)") && | |
branch=$(echo "$branches" | fzf --multi ) && | |
git branch -D $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##") | |
} | |
## place this in your ~/.zshrc and make sure you have fzf installed: brew install fzf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment