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
| #!/bin/bash | |
| # Prunes local branches no longer in the remote | |
| echo -e "git fetch -p" | |
| git fetch -p | |
| echo -e "git remote prune origin" | |
| git remote prune origin | |
| for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do | |
| echo -e "git branch -D \"$branch\"" |