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
| #/usr/local/bin/zsh | |
| # Credit to http://snippets.freerobby.com/post/491644841/remove-merged-branches-in-git for the script on which this is based | |
| current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
| if [ "$current_branch" != "master" ]; then | |
| echo "WARNING: You are on branch $current_branch, NOT master." | |
| fi | |
| echo "Fetching merged branches..." | |
| git remote prune origin | |
| local_branches=$(git branch --merged | grep -v 'master$' | grep -v "$current_branch$") |