Skip to content

Instantly share code, notes, and snippets.

@okwme
Last active May 2, 2019 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okwme/387d593c6312de2e90984ce1278917e8 to your computer and use it in GitHub Desktop.
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
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