Skip to content

Instantly share code, notes, and snippets.

@miguelgraz
Last active August 29, 2015 14:16
Show Gist options
  • Save miguelgraz/44d41cc8269bb12542f1 to your computer and use it in GitHub Desktop.
Save miguelgraz/44d41cc8269bb12542f1 to your computer and use it in GitHub Desktop.
Remove locally branches already removed on remote
The script checks out your master branch and compares the deleted branches
git checkout master; git pull origin master; git fetch --all -p; git branch -vv | grep gone | awk '{ print $1 }' | xargs -n 1 git branch -d
All credits to http://stackoverflow.com/a/28020809/645223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment