Last active
May 2, 2019 13:20
-
-
Save okwme/387d593c6312de2e90984ce1278917e8 to your computer and use it in GitHub Desktop.
bez's script to purge local branches that are not on the remote repo
This file contains 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
func purge_local_git_branches() { | |
red='\033[0;31m' | |
echo "${red}Purging local branches no longer found on remote..." | |
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment